All checks were successful
## What & why Before this change the self-service confirmation and the openbaar register showed **different** identifiers, so a citizen could not look their registration back up (#78). Now both surface the same **reference**: - **domain → ACL (write):** the domain `registrationId` is set as the zaak's `identificatie` on `POST /zaken`. - **event-subscriber → ACL (read):** the subscriber reads the zaak's `identificatie` back through the ACL (§8.1 — only the ACL talks to ZGW) via a new `POST /zaken/reference`, and stores it on the projection row **and** the `processed_notifications` replay log. - **BFF + openbaar:** the public view exposes `id/status/reference` (never bsn/naam) and searches by id or reference; the register's "Referentie" column shows the reference. Storing the reference in the replay log keeps ADR-0008's **rebuild-is-log-only** invariant intact — `/admin/rebuild` reproduces the reference without re-reading the ACL. Decision recorded in **ADR-0012**. ## Definition of Done - [x] Linked issue: #78 - [x] Tests written first; red → green per layer - [x] Unit + acceptance green (`make unit`): domain 49, acl 27, bff 20, event-subscriber 19, acceptance 7 - [x] Frontend lint + test green (`nx run-many -t lint test`) - [x] Mutation ≥ break(90): acl 100%, event-subscriber 100%, bff 100%, domain 98.41% (pre-existing FlowableWorkflowClient baseline, untouched) - [x] e2e extended: confirmation reference == register reference - [x] openapi.json + api-client regenerated (drift guard green) - [x] ADR-0012 added; demo-script note appended - [x] `Acl__BaseUrl` wired for the subscriber in compose closes #78 Reviewed-on: #79
49 lines
2.3 KiB
C#
49 lines
2.3 KiB
C#
using System.Net.Http.Json;
|
|
|
|
namespace Bff.Api;
|
|
|
|
/// <summary>What the self-service submit returns to the portal (the domain's registration id + status).</summary>
|
|
public sealed record SubmitAccepted(string RegistrationId, string Status);
|
|
|
|
/// <summary>A projection row as the projection-api serves it. <c>Bsn</c>/<c>NaamPlaceholder</c> are
|
|
/// read but never surfaced by the openbaar endpoint (public-safe filtering, ADR-0010/S-09).
|
|
/// <c>Reference</c> is the public-safe citizen reference (the zaak identificatie, #78).</summary>
|
|
public sealed record ProjectionEntry(string Id, string Status, string? Reference, string? Bsn, string? NaamPlaceholder);
|
|
|
|
/// <summary>A public-safe openbaar register row — only non-sensitive fields leave the BFF.</summary>
|
|
public sealed record OpenbaarEntry(string Id, string Status, string? Reference);
|
|
|
|
/// <summary>Port to the Domain Service (§8.3: the BFF is the portals' only backend; it fans out).</summary>
|
|
public interface IDomainClient
|
|
{
|
|
Task<SubmitAccepted> SubmitRegistrationAsync(string bsn, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>Port to the read projection.</summary>
|
|
public interface IProjectionClient
|
|
{
|
|
Task<IReadOnlyList<ProjectionEntry>> GetRegisterAsync(CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>Calls the Domain Service's <c>POST /registrations</c>.</summary>
|
|
public sealed class DomainClient(HttpClient http) : IDomainClient
|
|
{
|
|
public async Task<SubmitAccepted> SubmitRegistrationAsync(string bsn, CancellationToken ct = default)
|
|
{
|
|
using var response = await http.PostAsJsonAsync("registrations", new { bsn }, ct);
|
|
response.EnsureSuccessStatusCode();
|
|
var dto = await response.Content.ReadFromJsonAsync<DomainResponse>(ct)
|
|
?? throw new InvalidOperationException("The Domain Service returned an empty registration response.");
|
|
return new SubmitAccepted(dto.RegistrationId, dto.Status);
|
|
}
|
|
|
|
private sealed record DomainResponse(string RegistrationId, string Status, string? ZaakUrl);
|
|
}
|
|
|
|
/// <summary>Calls the projection-api's <c>GET /register</c>.</summary>
|
|
public sealed class ProjectionClient(HttpClient http) : IProjectionClient
|
|
{
|
|
public async Task<IReadOnlyList<ProjectionEntry>> GetRegisterAsync(CancellationToken ct = default)
|
|
=> await http.GetFromJsonAsync<List<ProjectionEntry>>("register", ct) ?? [];
|
|
}
|