feat(backend): expand stamdata + OpenZaak-ready cases seam (WP-49)
CI / frontend (push) Successful in 2m59s
CI / backend (push) Successful in 1m27s
CI / semgrep (push) Successful in 58s
CI / e2e (push) Successful in 2m30s
CI / api-client-drift (push) Canceled after 1m14s
CI / storybook-a11y (push) Canceled after 29m8s
CI / frontend (push) Successful in 2m59s
CI / backend (push) Successful in 1m27s
CI / semgrep (push) Successful in 58s
CI / e2e (push) Successful in 2m30s
CI / api-client-drift (push) Canceled after 1m14s
CI / storybook-a11y (push) Canceled after 29m8s
Stamdata: add beroepen, opleidingen (temporal), and specialismen tables to the schema-driven catalog (zero UI code). opleidingen.beroep and specialismen.beroep both reference beroepen.code — the first stamdata->stamdata references, enforced by two new StamdataRef entries in the CI gate. OpenZaak/ZGW (WP-49, slice 1 — read-only zaken): introduce IZaakSource as the cases read seam. Default LocalZaakSource reads the local SQLite store (offline); an OpenZaakZaakSource (Zgw/ client: HS256 per-call JWT, ZGW->existing-DTO mapper, paginating HTTP source) is selected behind Zgw:Enabled (default false). The FE never changes — same ApplicationSummaryDto, no api-client drift. Unit-tested with fixtures + a stub HttpMessageHandler; no live OpenZaak needed. Docs: ADR-0005, reference/openzaak-integration.md, WP-49..52 roadmap, stamdata.md update, README index rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using System.Text.Json;
|
||||
using BigRegister.Api.Zgw;
|
||||
|
||||
namespace BigRegister.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The anti-corruption map is where ZGW's URL-as-identity + cross-service zaaktype join get
|
||||
/// flattened into the FE's existing DTO. Feeds a captured ZGW Zaak shape and asserts the
|
||||
/// mapping — the guarantee that the FE never sees a ZGW shape.
|
||||
/// </summary>
|
||||
public class ZgwZaakMapperTests
|
||||
{
|
||||
private const string OpenZaakJson = """
|
||||
{
|
||||
"url": "https://open-zaak.example/zaken/api/v1/zaken/6f2c5f6e-1b1a-4b7e-9c3d-000000000001",
|
||||
"identificatie": "ZAAK-2026-0000000001",
|
||||
"zaaktype": "https://open-zaak.example/catalogi/api/v1/zaaktypen/aaaaaaaa-0000-0000-0000-000000000001",
|
||||
"startdatum": "2026-03-01",
|
||||
"einddatum": null,
|
||||
"registratiedatum": "2026-03-02"
|
||||
}
|
||||
""";
|
||||
|
||||
private const string ClosedZaakJson = """
|
||||
{
|
||||
"url": "https://open-zaak.example/zaken/api/v1/zaken/6f2c5f6e-1b1a-4b7e-9c3d-000000000002",
|
||||
"identificatie": "ZAAK-2026-0000000002",
|
||||
"zaaktype": "https://open-zaak.example/catalogi/api/v1/zaaktypen/aaaaaaaa-0000-0000-0000-000000000001",
|
||||
"startdatum": "2026-01-05",
|
||||
"einddatum": "2026-02-10",
|
||||
"registratiedatum": "2026-01-06"
|
||||
}
|
||||
""";
|
||||
|
||||
[Fact]
|
||||
public void Maps_url_identity_zaaktype_and_open_status()
|
||||
{
|
||||
var zaak = JsonSerializer.Deserialize<ZgwZaak>(OpenZaakJson)!;
|
||||
|
||||
var dto = ZgwZaakMapper.ToSummaryDto(zaak, "Herregistratie arts");
|
||||
|
||||
// URL as identity → the trailing uuid, not the whole URL.
|
||||
Assert.Equal("6f2c5f6e-1b1a-4b7e-9c3d-000000000001", dto.Id);
|
||||
// zaaktype URL resolved to its human label (the cross-service join).
|
||||
Assert.Equal("Herregistratie arts", dto.Type);
|
||||
Assert.Equal("ZAAK-2026-0000000001", dto.Status.Referentie);
|
||||
Assert.Equal("InBehandeling", dto.Status.Tag); // no einddatum → open
|
||||
Assert.True(dto.Status.Manual);
|
||||
Assert.Empty(dto.DocumentIds);
|
||||
// Wire shape matches the local source: round-trip datetime at midnight UTC.
|
||||
Assert.Equal("2026-03-02T00:00:00.0000000Z", dto.CreatedAt);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Closed_zaak_maps_to_goedgekeurd()
|
||||
{
|
||||
var zaak = JsonSerializer.Deserialize<ZgwZaak>(ClosedZaakJson)!;
|
||||
|
||||
var dto = ZgwZaakMapper.ToSummaryDto(zaak, "Herregistratie arts");
|
||||
|
||||
Assert.Equal("Goedgekeurd", dto.Status.Tag);
|
||||
Assert.Equal("2026-02-10T00:00:00.0000000Z", dto.UpdatedAt); // einddatum drives UpdatedAt
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Uuid_extracts_trailing_segment_ignoring_trailing_slash()
|
||||
{
|
||||
Assert.Equal("abc", ZgwZaakMapper.Uuid("https://host/zaken/api/v1/zaken/abc"));
|
||||
Assert.Equal("abc", ZgwZaakMapper.Uuid("https://host/zaken/api/v1/zaken/abc/"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user