From 9b2261b698ccad95cdde27372dbfbffd33beea64 Mon Sep 17 00:00:00 2001 From: Arne Dumarey Date: Wed, 2 Oct 2024 11:38:27 +0200 Subject: [PATCH] fix: municipality merger in syndication --- .../Municipality/MunicipalityEvent.cs | 2 ++ .../Municipality/MunicipalityLatestProjections.cs | 1 + .../Municipality/MunicipalitySyndicationProjections.cs | 1 + .../ProjectionTests/MunicipalityAtomEntryProjectionsTests.cs | 1 + 4 files changed, 5 insertions(+) diff --git a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityEvent.cs b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityEvent.cs index 2e32e9d44..136daeb24 100644 --- a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityEvent.cs +++ b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityEvent.cs @@ -18,5 +18,7 @@ public enum MunicipalityEvent MunicipalityWasCorrectedToCurrent, MunicipalityWasRetired, MunicipalityWasCorrectedToRetired, + + MunicipalityWasMerged } } diff --git a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityLatestProjections.cs b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityLatestProjections.cs index bea5cbed2..d2afef749 100755 --- a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityLatestProjections.cs +++ b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalityLatestProjections.cs @@ -23,6 +23,7 @@ public MunicipalityLatestProjections() When(MunicipalityEvent.MunicipalityOfficialLanguageWasRemoved, AddSyndicationItemEntry); When(MunicipalityEvent.MunicipalityFacilitiesLanguageWasAdded, AddSyndicationItemEntry); When(MunicipalityEvent.MunicipalityFacilitiesLanguageWasRemoved, AddSyndicationItemEntry); + When(MunicipalityEvent.MunicipalityWasMerged, AddSyndicationItemEntry); } private static async Task AddSyndicationItemEntry(AtomEntry> entry, SyndicationContext context, CancellationToken ct) diff --git a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalitySyndicationProjections.cs b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalitySyndicationProjections.cs index 16684a9e8..bb5c75a72 100644 --- a/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalitySyndicationProjections.cs +++ b/src/StreetNameRegistry.Projections.Syndication/Municipality/MunicipalitySyndicationProjections.cs @@ -18,6 +18,7 @@ public MunicipalitySyndicationProjections() When(MunicipalityEvent.MunicipalityNameWasCleared, AddSyndicationItemEntry); When(MunicipalityEvent.MunicipalityNameWasCorrected, AddSyndicationItemEntry); When(MunicipalityEvent.MunicipalityNameWasCorrectedToCleared, AddSyndicationItemEntry); + When(MunicipalityEvent.MunicipalityWasMerged, AddSyndicationItemEntry); //these events only update version timestamp & position When(MunicipalityEvent.MunicipalityOfficialLanguageWasAdded, AddSyndicationItemEntry); diff --git a/test/StreetNameRegistry.Tests/ProjectionTests/MunicipalityAtomEntryProjectionsTests.cs b/test/StreetNameRegistry.Tests/ProjectionTests/MunicipalityAtomEntryProjectionsTests.cs index 761a40003..0eb4788cf 100755 --- a/test/StreetNameRegistry.Tests/ProjectionTests/MunicipalityAtomEntryProjectionsTests.cs +++ b/test/StreetNameRegistry.Tests/ProjectionTests/MunicipalityAtomEntryProjectionsTests.cs @@ -26,6 +26,7 @@ public MunicipalityAtomEntryProjectionsTests(ITestOutputHelper output) : base(ou [InlineData(MunicipalityEvent.MunicipalityNameWasCorrectedToCleared)] [InlineData(MunicipalityEvent.MunicipalityNisCodeWasDefined)] [InlineData(MunicipalityEvent.MunicipalityNisCodeWasCorrected)] + [InlineData(MunicipalityEvent.MunicipalityWasMerged)] public async Task MunicipalityEventInsertsRecord(MunicipalityEvent @event) { var id = Arrange(Produce.Guid());