Skip to content

Commit

Permalink
fix: command provenance should be set after idempotency check
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandaal authored and ArneD committed Jan 9, 2024
1 parent cafbbeb commit 6e2f232
Show file tree
Hide file tree
Showing 23 changed files with 83 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ await IdempotentCommandHandler.Dispatch(
addressPersistentLocalId,
destinationAddress.AddressPersistentLocalId,
destinationBoxNumbers,
request.CommandProvenance);
request.Provenance);

await scope.Resolve<IIdempotentCommandHandler>().Dispatch(
rejectOrRetireAddresses.CreateCommandId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,5 @@ protected AddressLambdaRequest(
IDictionary<string, object?> metadata)
: base(messageGroupId, ticketId, ifMatchHeaderValue, provenance, metadata)
{ }

internal Provenance CommandProvenance => new Provenance(
SystemClock.Instance.GetCurrentInstant(),
Provenance.Application,
Provenance.Reason,
Provenance.Operator,
Provenance.Modification,
Provenance.Organisation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record ApproveAddressLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<ApproveAddressRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public ApproveAddressLambdaRequest(string groupId, ApproveAddressSqsRequest sqsRequest)
: base(
Expand All @@ -32,7 +32,7 @@ public ApproveAddressLambdaRequest(string groupId, ApproveAddressSqsRequest sqsR
/// <returns>ApproveAddress.</returns>
public ApproveAddress ToCommand()
{
return new ApproveAddress(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), CommandProvenance);
return new ApproveAddress(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
using Abstractions.Converters;
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record ChangeAddressPositionLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<ChangeAddressPositionRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public ChangeAddressPositionLambdaRequest(
string groupId,
Expand Down Expand Up @@ -43,7 +43,7 @@ public ChangeAddressPosition ToCommand()
Request.PositieGeometrieMethode.Map(),
Request.PositieSpecificatie.Map(),
Request.Positie.ToExtendedWkbGeometry(),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ namespace AddressRegistry.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 StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record ChangeAddressPostalCodeLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<ChangeAddressPostalCodeRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public ChangeAddressPostalCodeLambdaRequest(string groupId, ChangeAddressPostalCodeSqsRequest sqsRequest)
: base(
Expand Down Expand Up @@ -43,7 +43,7 @@ public ChangeAddressPostalCode ToCommand()
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
postalCode,
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressApprovalLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressApprovalRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressApprovalLambdaRequest(string groupId, CorrectAddressApprovalSqsRequest sqsRequest)
: base(
Expand All @@ -32,7 +32,7 @@ public CorrectAddressApprovalLambdaRequest(string groupId, CorrectAddressApprova
/// <returns>CorrectAddressApproval.</returns>
public CorrectAddressApproval ToCommand()
{
return new CorrectAddressApproval(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), CommandProvenance);
return new CorrectAddressApproval(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressBoxNumberLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressBoxNumberRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressBoxNumberLambdaRequest(string groupId, CorrectAddressBoxNumberSqsRequest sqsRequest)
: base(
Expand Down Expand Up @@ -37,7 +37,7 @@ public CorrectAddressBoxNumber ToCommand()
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
BoxNumber.Create(Request.Busnummer),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressDeregulationLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressDeregulationRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressDeregulationLambdaRequest(string groupId, CorrectAddressDeregulationSqsRequest regularizationSqsRequest)
: base(
Expand All @@ -35,7 +35,7 @@ public CorrectAddressDeregulation ToCommand()
return new CorrectAddressDeregulation(
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressHouseNumberLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressHouseNumberRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressHouseNumberLambdaRequest(string groupId, CorrectAddressHouseNumberSqsRequest sqsRequest)
: base(
Expand Down Expand Up @@ -37,7 +37,7 @@ public CorrectAddressHouseNumber ToCommand()
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
HouseNumber.Create(Request.Huisnummer),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
using Abstractions.Converters;
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressPositionLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressPositionRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressPositionLambdaRequest(string groupId, CorrectAddressPositionSqsRequest sqsRequest)
: base(
Expand Down Expand Up @@ -41,7 +41,7 @@ public CorrectAddressPosition ToCommand()
Request.PositieGeometrieMethode.Map(),
Request.PositieSpecificatie.Map(),
Request.Positie.ToExtendedWkbGeometry(),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ namespace AddressRegistry.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 StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressPostalCodeLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressPostalCodeRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressPostalCodeLambdaRequest(string groupId, CorrectAddressPostalCodeSqsRequest sqsRequest)
: base(
Expand Down Expand Up @@ -44,7 +44,7 @@ public CorrectAddressPostalCode ToCommand(MunicipalityId municipalityId)
new AddressPersistentLocalId(AddressPersistentLocalId),
postalCode,
municipalityId,
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressRegularizationLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressRegularizationRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressRegularizationLambdaRequest(string groupId, CorrectAddressRegularizationSqsRequest regularizationSqsRequest)
: base(
Expand All @@ -35,7 +35,7 @@ public CorrectAddressRegularization ToCommand()
return new CorrectAddressRegularization(
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressRejectionLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressRejectionRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressRejectionLambdaRequest(string groupId, CorrectAddressRejectionSqsRequest sqsRequest)
: base(
Expand All @@ -35,7 +35,7 @@ public CorrectAddressRejection ToCommand()
return new CorrectAddressRejection(
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record CorrectAddressRetirementLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<CorrectAddressRetirementRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public CorrectAddressRetirementLambdaRequest(string groupId, CorrectAddressRetirementSqsRequest sqsRequest)
: base(
Expand All @@ -32,7 +32,7 @@ public CorrectAddressRetirementLambdaRequest(string groupId, CorrectAddressRetir
/// <returns>CorrectAddressRetirement.</returns>
public CorrectAddressRetirement ToCommand()
{
return new CorrectAddressRetirement(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), CommandProvenance);
return new CorrectAddressRetirement(this.StreetNamePersistentLocalId(), new AddressPersistentLocalId(AddressPersistentLocalId), Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;
using IHasAddressPersistentLocalId = Abstractions.IHasAddressPersistentLocalId;

public sealed record DeregulateAddressLambdaRequest :
AddressLambdaRequest,
IHasBackOfficeRequest<DeregulateAddressRequest>,
Abstractions.IHasAddressPersistentLocalId
IHasAddressPersistentLocalId
{
public DeregulateAddressLambdaRequest(string groupId, DeregulateAddressSqsRequest sqsRequest)
: base(
Expand All @@ -35,7 +35,7 @@ public DeregulateAddress ToCommand()
return new DeregulateAddress(
this.StreetNamePersistentLocalId(),
new AddressPersistentLocalId(AddressPersistentLocalId),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
using Abstractions.Converters;
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName;
using StreetName.Commands;

Expand Down Expand Up @@ -46,7 +45,7 @@ public ProposeAddress ToCommand(
Request.PositieGeometrieMethode.Map(),
Request.PositieSpecificatie.Map(),
Request.Positie.ToExtendedWkbGeometry(),
CommandProvenance);
Provenance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ namespace AddressRegistry.Api.BackOffice.Handlers.Lambda.Requests
{
using Abstractions.Requests;
using Abstractions.SqsRequests;
using Be.Vlaanderen.Basisregisters.Sqs.Lambda.Requests;
using StreetName.Commands;

public sealed record ReaddressLambdaRequest :
Expand Down Expand Up @@ -32,7 +31,7 @@ public Readdress ToCommand(List<ReaddressAddressItem> readdressAddressItems, Lis
this.StreetNamePersistentLocalId(),
readdressAddressItems,
retireAddressItems,
CommandProvenance);
Provenance);
}
}
}
Loading

0 comments on commit 6e2f232

Please sign in to comment.