All checks were successful
## What & why S-09b (#75, split from #10) — the **approval flow** that completes the walking skeleton. A behandelaar can now approve a submitted registration; the entry flips from `INGEDIEND` to `INGESCHREVEN` in the public register. Flow: `POST /registrations/{id}/approve` (domain) → ACL sets the zaak eindstatus (ZGW `/statussen`) → OpenZaak → NRC → event-subscriber → projection → openbaar. ## Changes (bottom-up, each red→green TDD) - **Domain** — `RegistrationStatus.Ingeschreven` + `Registration.Approve()` (guards: opened zaak, only from INGEDIEND); `ApproveRegistration` use case (idempotent) + temp `POST /registrations/{id}/approve` endpoint; `IAclClient.ApproveZaakAsync`. - **ACL** — resolves the zaaktype's **eindstatus** from the catalogus (`isEindstatus` / highest volgnummer) and POSTs a ZGW status; exposed as `POST /statussen`. Unit + real-OpenZaak integration test. - **Event-subscriber** — binds NRC `hoofdObject`, projects a `status`/`create` as `INGESCHREVEN` keyed on the zaak (updates the existing row), **without reading OpenZaak** (§8.1). Retains the ZGW `resource` in the log (new column + EF migration) so a rebuild reproduces the status. - **e2e** — extended: submit → public INGEDIEND → approve → public INGESCHREVEN. - **Docs** — ADR-0011 (the two non-obvious decisions + the walking-skeleton assumption) + demo note. ## Key decisions (see ADR-0011) - **ACL discovers the eindstatus** (chosen over injecting a statustype URL): no new config/seed plumbing, domain stays ZGW-ignorant. - **Any post-creation status-set ⇒ INGESCHREVEN**: in the walking skeleton the only status ever set after creation is the approval, and the subscriber may not read ZGW — documented to tighten when more transitions arrive (S-12+). ## Verification - All .NET unit suites green locally (domain 47, acl 11, event-subscriber 14, bff 16, acceptance 7); Release build + `dotnet format` clean. - No new compose config (the eindstatus-discovery approach avoided it). - The real-OpenZaak integration test (ACL status-set) and the full submit→approve→visible e2e run in CI `verify-stack` (live NRC→projection + selectielijst egress, not reproducible locally). closes #75 Reviewed-on: #77
54 lines
2.3 KiB
C#
54 lines
2.3 KiB
C#
using Big.Domain;
|
|
|
|
namespace Big.Application;
|
|
|
|
/// <summary>
|
|
/// The port to the workflow engine. Implemented by the Workflow Client in Infrastructure — the
|
|
/// <em>only</em> code that talks to Flowable (CLAUDE.md §8.2). The application asks it to start the
|
|
/// registratie process; it never knows Flowable exists.
|
|
/// </summary>
|
|
public interface IWorkflowClient
|
|
{
|
|
/// <summary>
|
|
/// Start one <c>registratie</c> process instance for the given registration, carrying the
|
|
/// registration id so the <c>OpenZaakAanmaken</c> external task can be correlated back to its
|
|
/// aggregate. Returns the process instance id.
|
|
/// </summary>
|
|
Task<string> StartRegistrationProcessAsync(RegistrationId registrationId, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The port to the Anti-Corruption Layer. Implemented in Infrastructure by an HTTP client to the
|
|
/// ACL service — the <em>only</em> code that talks to ZGW (CLAUDE.md §8.1). The domain hands over a
|
|
/// bsn; the ACL default-fills the ZGW-mandatory fields (ADR-0003) and returns the created zaak URL.
|
|
/// </summary>
|
|
public interface IAclClient
|
|
{
|
|
Task<Uri> OpenZaakAsync(string bsn, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Record the approval on the given zaak. The ACL translates this to the ZGW concept — setting
|
|
/// the zaak's final status — which OpenZaak notifies over NRC; the domain never names statustypen.
|
|
/// </summary>
|
|
Task ApproveZaakAsync(Uri zaakUrl, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Persistence port for the <see cref="Registration"/> aggregate. In-memory for the minimal slice
|
|
/// (ADR-0009); an EF-backed store is a documented follow-up, and this port keeps that change additive.
|
|
/// </summary>
|
|
public interface IRegistrationStore
|
|
{
|
|
/// <summary>Insert or update the registration, keyed on its id.</summary>
|
|
Task SaveAsync(Registration registration, CancellationToken ct = default);
|
|
|
|
/// <summary>Load a registration by id, or <c>null</c> if none exists.</summary>
|
|
Task<Registration?> GetAsync(RegistrationId id, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// An acquired <c>OpenZaakAanmaken</c> external-worker job: the Flowable job id (needed to complete
|
|
/// it) and the registration id it carries as a process variable.
|
|
/// </summary>
|
|
public sealed record OpenZaakJob(string JobId, RegistrationId RegistrationId);
|