Skip to content

Commit

Permalink
fix: dont do rename municipality check on nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Jan 17, 2024
1 parent 59aa7e3 commit 8f4eedd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public RenameStreetNameRequestValidator(BackOfficeContext backOfficeContext)
.MunicipalityIdByPersistentLocalId
.FindAsync(new object?[] { request.StreetNamePersistentLocalId }, cancellationToken: ct);

// Allow nulls to go through, because otherwise the error message would be incorrect
// It will fail in the next rule / domain anyway
return
municipalityIdBySourcePersistentLocalId != null
&& municipalityIdByDestinationPersistentLocalId != null
&& municipalityIdByDestinationPersistentLocalId.MunicipalityId == municipalityIdBySourcePersistentLocalId.MunicipalityId;
municipalityIdBySourcePersistentLocalId is null
|| municipalityIdByDestinationPersistentLocalId is null
|| municipalityIdByDestinationPersistentLocalId.MunicipalityId == municipalityIdBySourcePersistentLocalId.MunicipalityId;
})
.WithMessage(ValidationErrors.RenameStreetName.SourceAndDestinationStreetNameAreNotInSameMunicipality.Message)
.WithErrorCode(ValidationErrors.RenameStreetName.SourceAndDestinationStreetNameAreNotInSameMunicipality.Code)
Expand Down

0 comments on commit 8f4eedd

Please sign in to comment.