Add ASP.NET Core backend hosting business rules; FE consumes via typed client
Move the authoritative business rules off the frontend into a real backend,
realising the BFF-lite + decision-DTO design (ADR-0001) that until now lived
only in static mock JSON.
Backend (backend/):
- ASP.NET Core (.NET 10) minimal API, contract-first, Swagger UI at /swagger.
- DDD Domain/ rules layer: profession derivation + applicable policy questions
(DiplomaRules), herregistratie eligibility + reason (HerregistratieRule),
scholing threshold (IntakePolicy), submit rejections + reference generation
(SubmissionRules). In-memory seeded data, ProblemDetails (RFC 7807) errors.
- 27 xUnit tests: rule units + endpoint integration incl. BRP no-address and
DUO not-found fallbacks and 422 submit paths.
Frontend (only infrastructure/ + contracts/ change, as the architecture promised):
- NSwag-generated typed client (api-client.ts), routed through Angular HttpClient
via a small fetch adapter so the ?scenario= interceptor still applies.
- GET adapters use resource({ loader: client.x }); submit commands call the client
and map ProblemDetails -> err. The hardcoded uren==0 / manual-diploma rules are
deleted (now server-side). Domain, stores, UI and format validators unchanged.
- Deleted the now-dead public/mock/*.json.
Tooling/docs:
- npm start proxies /api -> backend; npm run gen:api regenerates the client;
docker compose up runs both (bind mounts use :z for SELinux/Fedora).
- backend/README.md walkthrough: adding a policy question is a one-file backend
change, no FE change, no client regen. Updated CLAUDE.md + ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
namespace BigRegister.Api.Contracts;
|
||||
|
||||
// Wire contracts (the FE⇄BE seam). Field names + shapes mirror the frontend's
|
||||
// contracts/*.dto.ts 1:1; the NSwag-generated TS client is produced from these.
|
||||
|
||||
public sealed record AdresDto(string Straat, string Postcode, string Woonplaats);
|
||||
|
||||
public sealed record RegistrationStatusDto(
|
||||
string Tag,
|
||||
string? HerregistratieDatum = null,
|
||||
string? GeschorstTot = null,
|
||||
string? Reden = null,
|
||||
string? DoorgehaaldOp = null);
|
||||
|
||||
public sealed record RegistrationDto(
|
||||
string BigNummer,
|
||||
string Naam,
|
||||
string Beroep,
|
||||
string Registratiedatum,
|
||||
string Geboortedatum,
|
||||
RegistrationStatusDto Status);
|
||||
|
||||
public sealed record PersonDto(string Naam, string Geboortedatum, AdresDto Adres);
|
||||
|
||||
public sealed record HerregistratieDecisionsDto(bool EligibleForHerregistratie, string? HerregistratieReason);
|
||||
|
||||
public sealed record DashboardViewDto(RegistrationDto Registration, PersonDto Person, HerregistratieDecisionsDto Decisions);
|
||||
|
||||
public sealed record AantekeningDto(string Type, string Omschrijving, string Datum);
|
||||
|
||||
public sealed record BrpAddressDto(bool Gevonden, AdresDto? Adres);
|
||||
|
||||
public sealed record PolicyQuestionDto(string Id, string Vraag, string Type);
|
||||
|
||||
public sealed record DuoDiplomaDto(
|
||||
string Id,
|
||||
string Naam,
|
||||
string Instelling,
|
||||
int Jaar,
|
||||
string Beroep,
|
||||
IReadOnlyList<PolicyQuestionDto> PolicyQuestions);
|
||||
|
||||
public sealed record ManualDiplomaPolicyDto(IReadOnlyList<string> Beroepen, IReadOnlyList<PolicyQuestionDto> PolicyQuestions);
|
||||
|
||||
public sealed record DuoLookupDto(IReadOnlyList<DuoDiplomaDto> Diplomas, ManualDiplomaPolicyDto Handmatig);
|
||||
|
||||
public sealed record IntakePolicyDto(int ScholingThreshold);
|
||||
|
||||
// Submit requests carry only the fields the server re-validates (UX-only fields
|
||||
// stay on the client). ponytail: a real submit would carry the full application.
|
||||
public sealed record RegistratieRequest(string DiplomaHerkomst);
|
||||
public sealed record IntakeRequest(int Uren);
|
||||
public sealed record HerregistratieRequest(int Uren);
|
||||
|
||||
public sealed record ReferentieResponse(string Referentie);
|
||||
Reference in New Issue
Block a user