diff --git a/services/event-subscriber/EventSubscriber.Api/Program.cs b/services/event-subscriber/EventSubscriber.Api/Program.cs index 07a4656..4505095 100644 --- a/services/event-subscriber/EventSubscriber.Api/Program.cs +++ b/services/event-subscriber/EventSubscriber.Api/Program.cs @@ -84,11 +84,12 @@ app.MapPost("/admin/rebuild", async (NotificationProjector projector, Cancellati await app.RunAsync(); -/// The NRC notification body, as Open Notificaties POSTs it. Only the fields the -/// projection needs are bound; aanmaakdatum/kenmerken are ignored for the minimal slice. -public sealed record NotificationDto(string Kanaal, string Resource, string Actie, Uri ResourceUrl, Uri? HoofdObject = null) +/// The NRC notification body, as Open Notificaties POSTs it. Only the fields the projector +/// needs are bound; aanmaakdatum, kenmerken and hoofdObject are ignored — for a +/// register write hoofdObject is the same object as resourceUrl (ADR-0030). +public sealed record NotificationDto(string Kanaal, string Resource, string Actie, Uri ResourceUrl) { - public Notification ToNotification() => new(Kanaal, Resource, Actie, ResourceUrl, HoofdObject); + public Notification ToNotification() => new(Kanaal, Resource, Actie, ResourceUrl); } public partial class Program diff --git a/services/event-subscriber/EventSubscriber.Application/Notification.cs b/services/event-subscriber/EventSubscriber.Application/Notification.cs index 76a013a..b04672a 100644 --- a/services/event-subscriber/EventSubscriber.Application/Notification.cs +++ b/services/event-subscriber/EventSubscriber.Application/Notification.cs @@ -16,15 +16,15 @@ public sealed record Notification( string Kanaal, string Resource, string Actie, - Uri ResourceUrl, - Uri? HoofdObject = null) + Uri ResourceUrl) { /// A register record written to Objecten — create on submit, update on /// approval, since the ACL upserts the same object for a registration (§8.6). public bool IsRegisterRecordWritten => Kanaal == "objecten" && Resource == "object" && Actie is "create" or "update"; - /// The object holding the register record. Objecten sets both fields to the object; - /// hoofdObject is the main resource by definition, so prefer it. - public Uri ObjectUrl => HoofdObject ?? ResourceUrl; + /// The object holding the register record. For a resource: object notification + /// Objecten sends the object as both hoofdObject and resourceUrl — the object is + /// the main resource — so the notification's own hoofdObject is not modelled. + public Uri ObjectUrl => ResourceUrl; } diff --git a/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs b/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs index 25aab00..39e733b 100644 --- a/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs +++ b/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs @@ -22,7 +22,7 @@ public sealed class NotificationProjectorTests private Notification RecordWritten(string actie = "create", string url = ObjectUrl, string status = RegistrationStatus.Ingediend, string zaakId = ZaakId) { _acl.Records[url] = new RegisterRecord(zaakId, status, "REG-2026-0001"); - return new Notification("objecten", "object", actie, new Uri(url), new Uri(url)); + return new Notification("objecten", "object", actie, new Uri(url)); } [Fact] diff --git a/tests/acceptance/Steps/RegisterProjectieBijwerkenSteps.cs b/tests/acceptance/Steps/RegisterProjectieBijwerkenSteps.cs index b2e535c..ae0e09e 100644 --- a/tests/acceptance/Steps/RegisterProjectieBijwerkenSteps.cs +++ b/tests/acceptance/Steps/RegisterProjectieBijwerkenSteps.cs @@ -28,7 +28,7 @@ public sealed class RegisterProjectieBijwerkenSteps // The ACL upserts one object per registration, so submit and approval share an object URL. var objectUrl = ObjectBase + id; _register.Records[objectUrl] = new RegisterRecord(id, status, "REG-" + id); - _notification = new Notification("objecten", "object", "create", new Uri(objectUrl), new Uri(objectUrl)); + _notification = new Notification("objecten", "object", "create", new Uri(objectUrl)); } [Given("the register notification is delivered to the event subscriber")]