All checks were successful
## What & why
Second half of **S-12c** (behandel-portal backend), completing the decision path per **ADR-0013**:
- **Domain:** `BeoordeelRegistratie` now, after applying the decision (aggregate + ACL for approval), **completes the open Flowable `Beoordelen` task** for that registration (found by registrationId) with the besluit, so the workflow advances. No open task → the decision still stands (completes nothing); idempotent.
- **BFF:** `POST /behandel/registrations/{id}/decide` behind the medewerker/`behandelaar` policy, forwarding `goedkeuren`/`afwijzen` to the domain. Validates the besluit vocabulary (400 on unknown) without troubling the domain.
Behavior: decide is **401** without a token, **403** without the role, **400** for an unknown besluit, **204** (forwarded) for a behandelaar.
This completes the behandel backend. **S-12d** (the Angular behandel-portal + Playwright e2e) closes umbrella #13 and retires the temporary `/approve`.
## Definition of Done
- [x] Linked issue: #13 (umbrella, `refs`)
- [x] Tests first; red → green per layer
- [x] Unit + acceptance green (`make unit`): domain 79, bff 27, acceptance 9 (acl/event-subscriber unaffected)
- [x] Beoordeling acceptance scenario asserts task completion (goedkeuren + afwijzen)
- [x] openapi.json + api-client regenerated (drift guard passes)
- [x] Mutation ≥ break(90): **domain 100%, bff 100%**
- [ ] CI green (pending)
Part of #13.
Reviewed-on: #86
298 lines
9.1 KiB
TypeScript
298 lines
9.1 KiB
TypeScript
/**
|
|
* Generated by orval v8.19.0 🍺
|
|
* Do not edit manually.
|
|
* Bff.Api | v1
|
|
* OpenAPI spec version: 1.0.0
|
|
*/
|
|
import {
|
|
HttpClient,
|
|
HttpHeaders,
|
|
HttpResponse as AngularHttpResponse
|
|
} from '@angular/common/http';
|
|
import type {
|
|
HttpContext,
|
|
HttpEvent,
|
|
HttpParams
|
|
} from '@angular/common/http';
|
|
|
|
import {
|
|
Injectable,
|
|
inject
|
|
} from '@angular/core';
|
|
|
|
import {
|
|
Observable
|
|
} from 'rxjs';
|
|
|
|
export interface DecideRequest {
|
|
besluit: string;
|
|
}
|
|
|
|
export interface OpenbaarEntry {
|
|
id: string;
|
|
status: string;
|
|
/** @nullable */
|
|
reference: string | null;
|
|
}
|
|
|
|
export interface SubmitAccepted {
|
|
registrationId: string;
|
|
status: string;
|
|
}
|
|
|
|
export interface WerkbakItem {
|
|
registrationId: string;
|
|
bsn: string;
|
|
status: string;
|
|
}
|
|
|
|
export type GetOpenbaarRegisterParams = {
|
|
q?: string;
|
|
};
|
|
|
|
interface HttpClientOptions {
|
|
readonly headers?: HttpHeaders | Record<string, string | string[]>;
|
|
readonly context?: HttpContext;
|
|
readonly params?:
|
|
| HttpParams
|
|
| Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
readonly reportProgress?: boolean;
|
|
readonly withCredentials?: boolean;
|
|
readonly credentials?: RequestCredentials;
|
|
readonly keepalive?: boolean;
|
|
readonly priority?: RequestPriority;
|
|
readonly cache?: RequestCache;
|
|
readonly mode?: RequestMode;
|
|
readonly redirect?: RequestRedirect;
|
|
readonly referrer?: string;
|
|
readonly integrity?: string;
|
|
readonly referrerPolicy?: ReferrerPolicy;
|
|
readonly transferCache?: {includeHeaders?: string[]} | boolean;
|
|
readonly timeout?: number;
|
|
}
|
|
|
|
type HttpClientBodyOptions = HttpClientOptions & {
|
|
readonly observe?: 'body';
|
|
};
|
|
|
|
type HttpClientEventOptions = HttpClientOptions & {
|
|
readonly observe: 'events';
|
|
};
|
|
|
|
type HttpClientResponseOptions = HttpClientOptions & {
|
|
readonly observe: 'response';
|
|
};
|
|
|
|
type HttpClientObserveOptions = HttpClientOptions & {
|
|
readonly observe?: 'body' | 'events' | 'response';
|
|
};
|
|
|
|
type AngularHttpParamValue = string | number | boolean | Array<string | number | boolean>;
|
|
type AngularHttpParamValueWithNullable = AngularHttpParamValue | null;
|
|
|
|
function filterParams(
|
|
params: Record<string, unknown>,
|
|
requiredNullableKeys?: ReadonlySet<string>,
|
|
preserveRequiredNullables?: false,
|
|
passthroughKeys?: undefined,
|
|
): Record<string, AngularHttpParamValue>;
|
|
function filterParams(
|
|
params: Record<string, unknown>,
|
|
requiredNullableKeys: ReadonlySet<string> | undefined,
|
|
preserveRequiredNullables: true,
|
|
passthroughKeys?: undefined,
|
|
): Record<string, AngularHttpParamValueWithNullable>;
|
|
function filterParams(
|
|
params: Record<string, unknown>,
|
|
requiredNullableKeys: ReadonlySet<string> | undefined,
|
|
preserveRequiredNullables: boolean | undefined,
|
|
passthroughKeys: ReadonlySet<string>,
|
|
): Record<string, unknown>;
|
|
function filterParams(
|
|
params: Record<string, unknown>,
|
|
requiredNullableKeys: ReadonlySet<string> = new Set(),
|
|
preserveRequiredNullables = false,
|
|
passthroughKeys: ReadonlySet<string> = new Set(),
|
|
): Record<string, unknown> {
|
|
const filteredParams: Record<string, unknown> = {};
|
|
for (const [key, value] of Object.entries(params)) {
|
|
if (passthroughKeys.has(key)) {
|
|
if (value !== undefined) {
|
|
filteredParams[key] = value;
|
|
}
|
|
continue;
|
|
}
|
|
if (Array.isArray(value)) {
|
|
const filtered = value.filter(
|
|
(item) =>
|
|
item != null &&
|
|
(typeof item === 'string' ||
|
|
typeof item === 'number' ||
|
|
typeof item === 'boolean'),
|
|
) as Array<string | number | boolean>;
|
|
if (filtered.length) {
|
|
filteredParams[key] = filtered;
|
|
}
|
|
} else if (
|
|
preserveRequiredNullables &&
|
|
value === null &&
|
|
requiredNullableKeys.has(key)
|
|
) {
|
|
filteredParams[key] = null;
|
|
} else if (
|
|
value != null &&
|
|
(typeof value === 'string' ||
|
|
typeof value === 'number' ||
|
|
typeof value === 'boolean')
|
|
) {
|
|
filteredParams[key] = value;
|
|
}
|
|
}
|
|
return filteredParams;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class BffApiV1Service {
|
|
private readonly http = inject(HttpClient);
|
|
postSelfServiceRegistrations<TData = SubmitAccepted>( options?: HttpClientBodyOptions): Observable<TData>;
|
|
postSelfServiceRegistrations<TData = SubmitAccepted>( options?: HttpClientEventOptions): Observable<HttpEvent<TData>>;
|
|
postSelfServiceRegistrations<TData = SubmitAccepted>( options?: HttpClientResponseOptions): Observable<AngularHttpResponse<TData>>;
|
|
postSelfServiceRegistrations<TData = SubmitAccepted>(
|
|
options?: HttpClientObserveOptions): Observable<TData | HttpEvent<TData> | AngularHttpResponse<TData>> {
|
|
if (options?.observe === 'events') {
|
|
return this.http.post<TData>(
|
|
`/self-service/registrations`,
|
|
undefined,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'events',
|
|
}
|
|
);
|
|
}
|
|
|
|
if (options?.observe === 'response') {
|
|
return this.http.post<TData>(
|
|
`/self-service/registrations`,
|
|
undefined,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'response',
|
|
}
|
|
);
|
|
}
|
|
|
|
return this.http.post<TData>(
|
|
`/self-service/registrations`,
|
|
undefined,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'body',
|
|
}
|
|
);
|
|
}
|
|
|
|
getOpenbaarRegister<TData = OpenbaarEntry[]>(params?: GetOpenbaarRegisterParams, options?: HttpClientBodyOptions): Observable<TData>;
|
|
getOpenbaarRegister<TData = OpenbaarEntry[]>(params?: GetOpenbaarRegisterParams, options?: HttpClientEventOptions): Observable<HttpEvent<TData>>;
|
|
getOpenbaarRegister<TData = OpenbaarEntry[]>(params?: GetOpenbaarRegisterParams, options?: HttpClientResponseOptions): Observable<AngularHttpResponse<TData>>;
|
|
getOpenbaarRegister<TData = OpenbaarEntry[]>(
|
|
params?: GetOpenbaarRegisterParams, options?: HttpClientObserveOptions): Observable<TData | HttpEvent<TData> | AngularHttpResponse<TData>> {
|
|
const filteredParams = filterParams({...params, ...options?.params}, new Set<string>([]));
|
|
|
|
if (options?.observe === 'events') {
|
|
return this.http.get<TData>(
|
|
`/openbaar/register`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'events',
|
|
params: filteredParams,}
|
|
);
|
|
}
|
|
|
|
if (options?.observe === 'response') {
|
|
return this.http.get<TData>(
|
|
`/openbaar/register`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'response',
|
|
params: filteredParams,}
|
|
);
|
|
}
|
|
|
|
return this.http.get<TData>(
|
|
`/openbaar/register`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'body',
|
|
params: filteredParams,}
|
|
);
|
|
}
|
|
|
|
getBehandelWerkbak<TData = WerkbakItem[]>( options?: HttpClientBodyOptions): Observable<TData>;
|
|
getBehandelWerkbak<TData = WerkbakItem[]>( options?: HttpClientEventOptions): Observable<HttpEvent<TData>>;
|
|
getBehandelWerkbak<TData = WerkbakItem[]>( options?: HttpClientResponseOptions): Observable<AngularHttpResponse<TData>>;
|
|
getBehandelWerkbak<TData = WerkbakItem[]>(
|
|
options?: HttpClientObserveOptions): Observable<TData | HttpEvent<TData> | AngularHttpResponse<TData>> {
|
|
if (options?.observe === 'events') {
|
|
return this.http.get<TData>(
|
|
`/behandel/werkbak`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'events',
|
|
}
|
|
);
|
|
}
|
|
|
|
if (options?.observe === 'response') {
|
|
return this.http.get<TData>(
|
|
`/behandel/werkbak`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'response',
|
|
}
|
|
);
|
|
}
|
|
|
|
return this.http.get<TData>(
|
|
`/behandel/werkbak`,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'body',
|
|
}
|
|
);
|
|
}
|
|
|
|
postBehandelRegistrationsIdDecide<TData = void>(id: string,
|
|
decideRequest: DecideRequest, options?: HttpClientBodyOptions): Observable<TData>;
|
|
postBehandelRegistrationsIdDecide<TData = void>(id: string,
|
|
decideRequest: DecideRequest, options?: HttpClientEventOptions): Observable<HttpEvent<TData>>;
|
|
postBehandelRegistrationsIdDecide<TData = void>(id: string,
|
|
decideRequest: DecideRequest, options?: HttpClientResponseOptions): Observable<AngularHttpResponse<TData>>;
|
|
postBehandelRegistrationsIdDecide<TData = void>(
|
|
id: string,
|
|
decideRequest: DecideRequest, options?: HttpClientObserveOptions): Observable<TData | HttpEvent<TData> | AngularHttpResponse<TData>> {
|
|
if (options?.observe === 'events') {
|
|
return this.http.post<TData>(
|
|
`/behandel/registrations/${id}/decide`,
|
|
decideRequest,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'events',
|
|
}
|
|
);
|
|
}
|
|
|
|
if (options?.observe === 'response') {
|
|
return this.http.post<TData>(
|
|
`/behandel/registrations/${id}/decide`,
|
|
decideRequest,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'response',
|
|
}
|
|
);
|
|
}
|
|
|
|
return this.http.post<TData>(
|
|
`/behandel/registrations/${id}/decide`,
|
|
decideRequest,{
|
|
...(options as Omit<NonNullable<typeof options>, 'observe'>),
|
|
observe: 'body',
|
|
}
|
|
);
|
|
}
|
|
|
|
};
|