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:
2026-06-26 20:05:53 +02:00
parent 4e9af05cc1
commit cf570a8132
62 changed files with 2618 additions and 394 deletions

545
backend/swagger.json Normal file
View File

@@ -0,0 +1,545 @@
{
"openapi": "3.0.4",
"info": {
"title": "BIG-register BFF",
"version": "v1"
},
"paths": {
"/api/dashboard-view": {
"get": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DashboardViewDto"
}
}
}
}
}
}
},
"/api/notes": {
"get": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AantekeningDto"
}
}
}
}
}
}
}
},
"/api/brp/address": {
"get": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BrpAddressDto"
}
}
}
}
}
}
},
"/api/duo/diplomas": {
"get": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DuoLookupDto"
}
}
}
}
}
}
},
"/api/intake/policy": {
"get": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IntakePolicyDto"
}
}
}
}
}
}
},
"/api/registrations": {
"post": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RegistratieRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReferentieResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/herregistraties": {
"post": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HerregistratieRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReferentieResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/intakes": {
"post": {
"tags": [
"BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IntakeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReferentieResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"AantekeningDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"omschrijving": {
"type": "string",
"nullable": true
},
"datum": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"AdresDto": {
"type": "object",
"properties": {
"straat": {
"type": "string",
"nullable": true
},
"postcode": {
"type": "string",
"nullable": true
},
"woonplaats": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"BrpAddressDto": {
"type": "object",
"properties": {
"gevonden": {
"type": "boolean"
},
"adres": {
"$ref": "#/components/schemas/AdresDto"
}
},
"additionalProperties": false
},
"DashboardViewDto": {
"type": "object",
"properties": {
"registration": {
"$ref": "#/components/schemas/RegistrationDto"
},
"person": {
"$ref": "#/components/schemas/PersonDto"
},
"decisions": {
"$ref": "#/components/schemas/HerregistratieDecisionsDto"
}
},
"additionalProperties": false
},
"DuoDiplomaDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"nullable": true
},
"naam": {
"type": "string",
"nullable": true
},
"instelling": {
"type": "string",
"nullable": true
},
"jaar": {
"type": "integer",
"format": "int32"
},
"beroep": {
"type": "string",
"nullable": true
},
"policyQuestions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PolicyQuestionDto"
},
"nullable": true
}
},
"additionalProperties": false
},
"DuoLookupDto": {
"type": "object",
"properties": {
"diplomas": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DuoDiplomaDto"
},
"nullable": true
},
"handmatig": {
"$ref": "#/components/schemas/ManualDiplomaPolicyDto"
}
},
"additionalProperties": false
},
"HerregistratieDecisionsDto": {
"type": "object",
"properties": {
"eligibleForHerregistratie": {
"type": "boolean"
},
"herregistratieReason": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"HerregistratieRequest": {
"type": "object",
"properties": {
"uren": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
"IntakePolicyDto": {
"type": "object",
"properties": {
"scholingThreshold": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
"IntakeRequest": {
"type": "object",
"properties": {
"uren": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
"ManualDiplomaPolicyDto": {
"type": "object",
"properties": {
"beroepen": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"policyQuestions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PolicyQuestionDto"
},
"nullable": true
}
},
"additionalProperties": false
},
"PersonDto": {
"type": "object",
"properties": {
"naam": {
"type": "string",
"nullable": true
},
"geboortedatum": {
"type": "string",
"nullable": true
},
"adres": {
"$ref": "#/components/schemas/AdresDto"
}
},
"additionalProperties": false
},
"PolicyQuestionDto": {
"type": "object",
"properties": {
"id": {
"type": "string",
"nullable": true
},
"vraag": {
"type": "string",
"nullable": true
},
"type": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"ProblemDetails": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
},
"additionalProperties": { }
},
"ReferentieResponse": {
"type": "object",
"properties": {
"referentie": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"RegistratieRequest": {
"type": "object",
"properties": {
"diplomaHerkomst": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"RegistrationDto": {
"type": "object",
"properties": {
"bigNummer": {
"type": "string",
"nullable": true
},
"naam": {
"type": "string",
"nullable": true
},
"beroep": {
"type": "string",
"nullable": true
},
"registratiedatum": {
"type": "string",
"nullable": true
},
"geboortedatum": {
"type": "string",
"nullable": true
},
"status": {
"$ref": "#/components/schemas/RegistrationStatusDto"
}
},
"additionalProperties": false
},
"RegistrationStatusDto": {
"type": "object",
"properties": {
"tag": {
"type": "string",
"nullable": true
},
"herregistratieDatum": {
"type": "string",
"nullable": true
},
"geschorstTot": {
"type": "string",
"nullable": true
},
"reden": {
"type": "string",
"nullable": true
},
"doorgehaaldOp": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
}
},
"tags": [
{
"name": "BigRegister.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
]
}