diff --git a/services/bff/Bff.Api/Program.cs b/services/bff/Bff.Api/Program.cs index c4683ce..940d5f2 100644 --- a/services/bff/Bff.Api/Program.cs +++ b/services/bff/Bff.Api/Program.cs @@ -104,6 +104,26 @@ app.MapPost("/self-service/registrations/{id}/withdraw", async (string id, Claim .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound); +// Self-service provide-documents (S-10a): the signed-in zorgprofessional supplies the documents their +// registration is waiting for ("documenten aanleveren"). The bsn comes from the DigiD token and is +// forwarded to the domain, which owner-scopes the action and completes the WachtOpDocumenten task; a +// registration that is unknown or not the caller's comes back 404. The real file upload + ZGW storage +// is S-10b — this is the trigger that unblocks the process. +app.MapPost("/self-service/registrations/{id}/documents", async (string id, ClaimsPrincipal user, IDomainClient domain, CancellationToken ct) => +{ + var bsn = user.FindFirstValue("bsn"); + if (string.IsNullOrWhiteSpace(bsn)) + return Results.BadRequest("The token carries no bsn claim."); + + var provided = await domain.ProvideDocumentsAsync(id, bsn, ct); + return provided ? Results.NoContent() : Results.NotFound(); +}) + .RequireAuthorization() + .Produces(StatusCodes.Status204NoContent) + .Produces(StatusCodes.Status400BadRequest) + .Produces(StatusCodes.Status401Unauthorized) + .Produces(StatusCodes.Status404NotFound); + // Openbaar register: an anonymous public lookup that exposes only public-safe fields (S-09). app.MapGet("/openbaar/register", async (string? q, IProjectionClient projection, CancellationToken ct) => { diff --git a/services/bff/openapi.json b/services/bff/openapi.json index 989a7a1..fd2101a 100644 --- a/services/bff/openapi.json +++ b/services/bff/openapi.json @@ -61,6 +61,37 @@ } } }, + "/self-service/registrations/{id}/documents": { + "post": { + "tags": [ + "Bff.Api" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request" + }, + "401": { + "description": "Unauthorized" + }, + "404": { + "description": "Not Found" + } + } + } + }, "/openbaar/register": { "get": { "tags": [