Files
atomic-design-poc/src/app/registratie/domain/aanvraag.ts
Edwin van den Houdt 6f250cd987 Mijn aanvragen (C): FE contracts + applications adapter + parse boundary
- Regenerate the NSwag client against the new backend endpoints (application +
  content methods, Aanvraag DTOs) — clears the API-client drift.
- registratie/domain/aanvraag.ts: FE domain view — AanvraagType + AanvraagStatus
  discriminated union (illegal states unrepresentable) + Aanvraag/AanvraagDetail.
  Lives in registratie: the dashboard consumes it, downstream wizards produce it.
- ApplicationsAdapter (infrastructure, the only new network surface): list resource
  + create/syncDraft/cancel/submit commands, with a hand-written parse* boundary
  (parseAanvraagStatus/parseApplicationSummary/parseApplications/parseApplicationDetail)
  mapping untrusted DTO -> domain, per ADR-0001. Spec covers each status tag + rejects.
- UploadAdapter.contentUrl(id): direct href for preview/download (browser opens it).

Gates green: dotnet test 56, vitest 122, lint, build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 11:41:57 +02:00

33 lines
1.3 KiB
TypeScript

/**
* An application (aanvraag) as the frontend sees it — the parsed, domain-side view
* of the backend-owned aggregate (see backend ApplicationStore + PRD 0001). Pure
* types, no Angular. Lives in `registratie` because the dashboard (here) is the
* consumer and the downstream wizards (`herregistratie → registratie`) produce them.
*
* The status is a discriminated union so illegal states are unrepresentable — same
* reflex as RemoteData. The server computes which tag applies (auto-approval on
* read); the FE renders it, it does not recompute the lifecycle.
*/
export type AanvraagType = 'registratie' | 'herregistratie' | 'intake';
export type AanvraagStatus =
| { tag: 'Concept'; stepIndex: number; stepCount: number }
| { tag: 'InBehandeling'; referentie: string; manual: boolean } // manual=true → "wordt handmatig beoordeeld"
| { tag: 'Goedgekeurd'; referentie: string }
| { tag: 'Afgewezen'; referentie: string; reden: string };
export interface Aanvraag {
id: string;
type: AanvraagType;
status: AanvraagStatus;
documentIds: string[];
createdAt: string;
updatedAt: string;
submittedAt?: string;
}
/** Detail adds the opaque wizard snapshot used to resume a Concept. */
export interface AanvraagDetail extends Aanvraag {
draft: unknown;
}