From 92615b4dc836e2dbdad44051734da1f6a9ece842 Mon Sep 17 00:00:00 2001 From: jvandaal Date: Wed, 20 Dec 2023 16:39:49 +0100 Subject: [PATCH] fix: event timestamp --- .../ApproveStreetNameLambdaRequest.cs | 8 +++--- .../ChangeStreetNameNamesLambdaRequest.cs | 5 ++-- .../CorrectStreetNameApprovalLambdaRequest.cs | 8 +++--- ...StreetNameHomonymAdditionsLambdaRequest.cs | 5 ++-- .../CorrectStreetNameNamesLambdaRequest.cs | 5 ++-- ...CorrectStreetNameRejectionLambdaRequest.cs | 8 +++--- ...orrectStreetNameRetirementLambdaRequest.cs | 8 +++--- .../ProposeStreetNameLambdaRequest.cs | 7 +++-- .../Requests/RejectStreetNameLambdaRequest.cs | 8 +++--- .../Requests/RemoveStreetNameLambdaRequest.cs | 8 +++--- .../Requests/RenameStreetNameLambdaRequest.cs | 5 ++-- .../Requests/RetireStreetNameLambdaRequest.cs | 8 +++--- .../Requests/StreetNameLambdaRequest.cs | 26 +++++++++++++++++++ 13 files changed, 72 insertions(+), 37 deletions(-) create mode 100644 src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/StreetNameLambdaRequest.cs diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ApproveStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ApproveStreetNameLambdaRequest.cs index 615001627..11c8c0ec5 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ApproveStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ApproveStreetNameLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record ApproveStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public ApproveStreetNameLambdaRequest(string groupId, ApproveStreetNameSqsReques /// ApproveStreetName. public ApproveStreetName ToCommand() { - return new ApproveStreetName(this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), Provenance); + return new ApproveStreetName( + this.MunicipalityPersistentLocalId(), + new PersistentLocalId(StreetNamePersistentLocalId), + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ChangeStreetNameNamesLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ChangeStreetNameNamesLambdaRequest.cs index d93916d99..1654464da 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ChangeStreetNameNamesLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ChangeStreetNameNamesLambdaRequest.cs @@ -4,12 +4,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions.Convertors; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record ChangeStreetNameNamesLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -42,7 +41,7 @@ public ChangeStreetNameNames ToCommand() this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), names, - Provenance); + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameApprovalLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameApprovalLambdaRequest.cs index 016390cba..0196e3132 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameApprovalLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameApprovalLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record CorrectStreetNameApprovalLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public CorrectStreetNameApprovalLambdaRequest(string groupId, CorrectStreetNameA /// CorrectStreetNameApproval. public CorrectStreetNameApproval ToCommand() { - return new CorrectStreetNameApproval(this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), Provenance); + return new CorrectStreetNameApproval( + this.MunicipalityPersistentLocalId(), + new PersistentLocalId(StreetNamePersistentLocalId), + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameHomonymAdditionsLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameHomonymAdditionsLambdaRequest.cs index 283961250..b1e3ab44f 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameHomonymAdditionsLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameHomonymAdditionsLambdaRequest.cs @@ -4,12 +4,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions.Convertors; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record CorrectStreetNameHomonymAdditionsLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -50,7 +49,7 @@ public CorrectStreetNameHomonymAdditions ToCommand() new PersistentLocalId(StreetNamePersistentLocalId), homonymAdditionsToCorrect, homonymsToRemove, - Provenance); + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameNamesLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameNamesLambdaRequest.cs index 5f1e923d8..dfe7a805e 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameNamesLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameNamesLambdaRequest.cs @@ -4,12 +4,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions.Convertors; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record CorrectStreetNameNamesLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -42,7 +41,7 @@ public CorrectStreetNameNames ToCommand() this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), names, - Provenance); + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRejectionLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRejectionLambdaRequest.cs index 28ae2860d..68948b2ce 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRejectionLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRejectionLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record CorrectStreetNameRejectionLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public CorrectStreetNameRejectionLambdaRequest(string groupId, CorrectStreetName /// CorrectStreetNameRejection. public CorrectStreetNameRejection ToCommand() { - return new CorrectStreetNameRejection(this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), Provenance); + return new CorrectStreetNameRejection( + this.MunicipalityPersistentLocalId(), + new PersistentLocalId(StreetNamePersistentLocalId), + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRetirementLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRetirementLambdaRequest.cs index 9a137ae79..45ef2679c 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRetirementLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/CorrectStreetNameRetirementLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record CorrectStreetNameRetirementLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public CorrectStreetNameRetirementLambdaRequest(string groupId, CorrectStreetNam /// CorrectStreetNameRetirement. public CorrectStreetNameRetirement ToCommand() { - return new CorrectStreetNameRetirement(this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), Provenance); + return new CorrectStreetNameRetirement( + this.MunicipalityPersistentLocalId(), + new PersistentLocalId(StreetNamePersistentLocalId), + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ProposeStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ProposeStreetNameLambdaRequest.cs index 5f75d2d50..9cf0ed3e6 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ProposeStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/ProposeStreetNameLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions.Convertors; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record ProposeStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest { public ProposeStreetNameLambdaRequest(string groupId, ProposeStreetNameSqsRequest sqsRequest) @@ -39,8 +38,8 @@ public ProposeStreetName ToCommand() return new ProposeStreetName( this.MunicipalityPersistentLocalId(), names, - this.PersistentLocalId, - Provenance); + PersistentLocalId, + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RejectStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RejectStreetNameLambdaRequest.cs index 2ebb04ae3..7747c62e2 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RejectStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RejectStreetNameLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record RejectStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public RejectStreetNameLambdaRequest(string groupId, RejectStreetNameSqsRequest /// RejectStreetName. public RejectStreetName ToCommand(PersistentLocalId streetNamePersistentLocalId) { - return new RejectStreetName(this.MunicipalityPersistentLocalId(), streetNamePersistentLocalId, Provenance); + return new RejectStreetName( + this.MunicipalityPersistentLocalId(), + streetNamePersistentLocalId, + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RemoveStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RemoveStreetNameLambdaRequest.cs index c6440bd3e..d2c4ad3ff 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RemoveStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RemoveStreetNameLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record RemoveStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public RemoveStreetNameLambdaRequest(string groupId, RemoveStreetNameSqsRequest /// RemoveStreetName. public RemoveStreetName ToCommand() { - return new RemoveStreetName(this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), Provenance); + return new RemoveStreetName( + this.MunicipalityPersistentLocalId(), + new PersistentLocalId(StreetNamePersistentLocalId), + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RenameStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RenameStreetNameLambdaRequest.cs index 9a5a50733..128f7a161 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RenameStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RenameStreetNameLambdaRequest.cs @@ -4,12 +4,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions.Requests; using Abstractions.SqsRequests; using Be.Vlaanderen.Basisregisters.GrAr.Common.Oslo.Extensions; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record RenameStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -43,7 +42,7 @@ public RenameStreetName ToCommand() this.MunicipalityPersistentLocalId(), new PersistentLocalId(StreetNamePersistentLocalId), new PersistentLocalId(identifier.Value), - Provenance); + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RetireStreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RetireStreetNameLambdaRequest.cs index e443824bf..db4c2d66a 100644 --- a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RetireStreetNameLambdaRequest.cs +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/RetireStreetNameLambdaRequest.cs @@ -3,12 +3,11 @@ namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests using Abstractions; using Abstractions.Requests; using Abstractions.SqsRequests; - using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; using Municipality; using Municipality.Commands; public sealed record RetireStreetNameLambdaRequest : - SqsLambdaRequest, + StreetNameLambdaRequest, IHasBackOfficeRequest, IHasStreetNamePersistentLocalId { @@ -33,7 +32,10 @@ public RetireStreetNameLambdaRequest(string groupId, RetireStreetNameSqsRequest /// RetireStreetName. public RetireStreetName ToCommand(PersistentLocalId streetNamePersistentLocalId) { - return new RetireStreetName(this.MunicipalityPersistentLocalId(), streetNamePersistentLocalId, Provenance); + return new RetireStreetName( + this.MunicipalityPersistentLocalId(), + streetNamePersistentLocalId, + CommandProvenance); } } } diff --git a/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/StreetNameLambdaRequest.cs b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/StreetNameLambdaRequest.cs new file mode 100644 index 000000000..c7725a104 --- /dev/null +++ b/src/StreetNameRegistry.Api.BackOffice.Handlers.Lambda/Requests/StreetNameLambdaRequest.cs @@ -0,0 +1,26 @@ +namespace StreetNameRegistry.Api.BackOffice.Handlers.Lambda.Requests +{ + using Be.Vlaanderen.Basisregisters.GrAr.Provenance; + using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests; + using NodaTime; + + public abstract record StreetNameLambdaRequest : SqsLambdaRequest + { + protected StreetNameLambdaRequest( + string messageGroupId, + Guid ticketId, + string? ifMatchHeaderValue, + Provenance provenance, + IDictionary metadata) + : base(messageGroupId, ticketId, ifMatchHeaderValue, provenance, metadata) + { } + + protected Provenance CommandProvenance => new Provenance( + SystemClock.Instance.GetCurrentInstant(), + Provenance.Application, + Provenance.Reason, + Provenance.Operator, + Provenance.Modification, + Provenance.Organisation); + } +}