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>
This commit is contained in:
@@ -487,6 +487,46 @@ export class ApiClient {
|
||||
return Promise.resolve<UploadCategoriesDto>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OK
|
||||
*/
|
||||
content(documentId: string): Promise<void> {
|
||||
let url_ = this.baseUrl + "/api/v1/uploads/{documentId}/content";
|
||||
if (documentId === undefined || documentId === null)
|
||||
throw new globalThis.Error("The parameter 'documentId' must be defined.");
|
||||
url_ = url_.replace("{documentId}", encodeURIComponent("" + documentId));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processContent(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processContent(response: Response): Promise<void> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
return;
|
||||
});
|
||||
} else if (status === 404) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("Not Found", status, _responseText, _headers);
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<void>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param localIds (optional)
|
||||
* @return OK
|
||||
@@ -617,6 +657,268 @@ export class ApiClient {
|
||||
}
|
||||
return Promise.resolve<void>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OK
|
||||
*/
|
||||
applicationsAll(): Promise<ApplicationSummaryDto[]> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processApplicationsAll(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processApplicationsAll(response: Response): Promise<ApplicationSummaryDto[]> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationSummaryDto[];
|
||||
return result200;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<ApplicationSummaryDto[]>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Created
|
||||
*/
|
||||
applicationsPOST(body: CreateApplicationRequest): Promise<ApplicationDetailDto> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(body);
|
||||
|
||||
let options_: RequestInit = {
|
||||
body: content_,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processApplicationsPOST(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processApplicationsPOST(response: Response): Promise<ApplicationDetailDto> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 201) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result201: any = null;
|
||||
result201 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationDetailDto;
|
||||
return result201;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<ApplicationDetailDto>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OK
|
||||
*/
|
||||
applicationsGET(id: string): Promise<ApplicationDetailDto> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications/{id}";
|
||||
if (id === undefined || id === null)
|
||||
throw new globalThis.Error("The parameter 'id' must be defined.");
|
||||
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processApplicationsGET(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processApplicationsGET(response: Response): Promise<ApplicationDetailDto> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationDetailDto;
|
||||
return result200;
|
||||
});
|
||||
} else if (status === 404) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("Not Found", status, _responseText, _headers);
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<ApplicationDetailDto>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return No Content
|
||||
*/
|
||||
applicationsPUT(id: string, body: DraftSyncRequest): Promise<void> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications/{id}";
|
||||
if (id === undefined || id === null)
|
||||
throw new globalThis.Error("The parameter 'id' must be defined.");
|
||||
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(body);
|
||||
|
||||
let options_: RequestInit = {
|
||||
body: content_,
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processApplicationsPUT(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processApplicationsPUT(response: Response): Promise<void> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return;
|
||||
});
|
||||
} else if (status === 404) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("Not Found", status, _responseText, _headers);
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<void>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return No Content
|
||||
*/
|
||||
applicationsDELETE(id: string): Promise<void> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications/{id}";
|
||||
if (id === undefined || id === null)
|
||||
throw new globalThis.Error("The parameter 'id' must be defined.");
|
||||
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processApplicationsDELETE(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processApplicationsDELETE(response: Response): Promise<void> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return;
|
||||
});
|
||||
} else if (status === 404) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("Not Found", status, _responseText, _headers);
|
||||
});
|
||||
} else if (status === 409) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result409: any = null;
|
||||
result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
|
||||
return throwException("Conflict", status, _responseText, _headers, result409);
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<void>(null as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OK
|
||||
*/
|
||||
submit(id: string, body: SubmitApplicationRequest): Promise<SubmitApplicationResponse> {
|
||||
let url_ = this.baseUrl + "/api/v1/applications/{id}/submit";
|
||||
if (id === undefined || id === null)
|
||||
throw new globalThis.Error("The parameter 'id' must be defined.");
|
||||
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(body);
|
||||
|
||||
let options_: RequestInit = {
|
||||
body: content_,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.http.fetch(url_, options_).then((_response: Response) => {
|
||||
return this.processSubmit(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processSubmit(response: Response): Promise<SubmitApplicationResponse> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as SubmitApplicationResponse;
|
||||
return result200;
|
||||
});
|
||||
} else if (status === 404) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("Not Found", status, _responseText, _headers);
|
||||
});
|
||||
} else if (status === 409) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result409: any = null;
|
||||
result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
|
||||
return throwException("Conflict", status, _responseText, _headers, result409);
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<SubmitApplicationResponse>(null as any);
|
||||
}
|
||||
}
|
||||
|
||||
export interface AantekeningDto {
|
||||
@@ -625,12 +927,42 @@ export interface AantekeningDto {
|
||||
datum?: string | undefined;
|
||||
}
|
||||
|
||||
export interface AanvraagStatusDto {
|
||||
tag?: string | undefined;
|
||||
stepIndex?: number | undefined;
|
||||
stepCount?: number | undefined;
|
||||
referentie?: string | undefined;
|
||||
manual?: boolean | undefined;
|
||||
reden?: string | undefined;
|
||||
}
|
||||
|
||||
export interface AdresDto {
|
||||
straat?: string | undefined;
|
||||
postcode?: string | undefined;
|
||||
woonplaats?: string | undefined;
|
||||
}
|
||||
|
||||
export interface ApplicationDetailDto {
|
||||
id?: string | undefined;
|
||||
type?: string | undefined;
|
||||
status?: AanvraagStatusDto;
|
||||
draft?: any | undefined;
|
||||
documentIds?: string[] | undefined;
|
||||
createdAt?: string | undefined;
|
||||
updatedAt?: string | undefined;
|
||||
submittedAt?: string | undefined;
|
||||
}
|
||||
|
||||
export interface ApplicationSummaryDto {
|
||||
id?: string | undefined;
|
||||
type?: string | undefined;
|
||||
status?: AanvraagStatusDto;
|
||||
documentIds?: string[] | undefined;
|
||||
createdAt?: string | undefined;
|
||||
updatedAt?: string | undefined;
|
||||
submittedAt?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BrpAddressDto {
|
||||
gevonden?: boolean;
|
||||
adres?: AdresDto;
|
||||
@@ -642,6 +974,10 @@ export interface ChangeRequestRequest {
|
||||
woonplaats?: string | undefined;
|
||||
}
|
||||
|
||||
export interface CreateApplicationRequest {
|
||||
type?: string | undefined;
|
||||
}
|
||||
|
||||
export interface DashboardViewDto {
|
||||
registration?: RegistrationDto;
|
||||
person?: PersonDto;
|
||||
@@ -665,6 +1001,13 @@ export interface DocumentRefDto {
|
||||
documentId?: string | undefined;
|
||||
}
|
||||
|
||||
export interface DraftSyncRequest {
|
||||
draft?: any;
|
||||
stepIndex?: number;
|
||||
stepCount?: number;
|
||||
documentIds?: string[] | undefined;
|
||||
}
|
||||
|
||||
export interface DuoDiplomaDto {
|
||||
id?: string | undefined;
|
||||
naam?: string | undefined;
|
||||
@@ -750,6 +1093,17 @@ export interface RegistrationStatusDto {
|
||||
doorgehaaldOp?: string | undefined;
|
||||
}
|
||||
|
||||
export interface SubmitApplicationRequest {
|
||||
diplomaHerkomst?: string | undefined;
|
||||
uren?: number | undefined;
|
||||
documents?: DocumentRefDto[] | undefined;
|
||||
}
|
||||
|
||||
export interface SubmitApplicationResponse {
|
||||
referentie?: string | undefined;
|
||||
status?: AanvraagStatusDto;
|
||||
}
|
||||
|
||||
export interface UploadCategoriesDto {
|
||||
categories?: DocumentCategoryDto[] | undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user