feat(acl): store a diploma in the Documenten API and relate it to the zaak (refs #103)
IZaakGateway.StoreDocumentAsync creates an enkelvoudiginformatieobject (base64 inhoud, buffered non-chunked body, no CRS) and relates it via zaakinformatieobjecten; AclService.StoreDiplomaAsync default-fills the ZGW document fields (informatieobjecttype, bronorganisatie, taal nld, creatiedatum); POST /documenten exposes it. Adds the InformatieobjecttypeUrl default (wired in a following infra commit). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,4 +7,8 @@ public sealed class AclDefaults
|
||||
public required string VerantwoordelijkeOrganisatie { get; init; }
|
||||
public required string Vertrouwelijkheidaanduiding { get; init; }
|
||||
public required Uri ZaaktypeUrl { get; init; }
|
||||
|
||||
/// <summary>The informatieobjecttype an uploaded diploma is filed under (S-10b). Seeded in the
|
||||
/// catalogus and injected like <see cref="ZaaktypeUrl"/>.</summary>
|
||||
public required Uri InformatieobjecttypeUrl { get; init; }
|
||||
}
|
||||
|
||||
@@ -37,4 +37,33 @@ public sealed class AclService(IZaakGateway gateway, AclDefaults defaults, ICloc
|
||||
|
||||
return gateway.GetZaakIdentificatieAsync(zaakUrl, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store an uploaded diploma against the zaak (S-10b): default-fill the ZGW-mandatory document
|
||||
/// fields (informatieobjecttype, bronorganisatie, vertrouwelijkheidaanduiding, taal, creatiedatum)
|
||||
/// and hand the file to the gateway, which creates the informatieobject and relates it to the zaak.
|
||||
/// The domain supplies only the zaak, the bytes, and the file's name/type (§8.1).
|
||||
/// </summary>
|
||||
public Task<Uri> StoreDiplomaAsync(Uri zaakUrl, byte[] content, string fileName, string contentType, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(zaakUrl);
|
||||
ArgumentNullException.ThrowIfNull(content);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(fileName);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(contentType);
|
||||
|
||||
var request = new DocumentRequest(
|
||||
defaults.Bronorganisatie,
|
||||
defaults.InformatieobjecttypeUrl,
|
||||
defaults.Vertrouwelijkheidaanduiding,
|
||||
zaakUrl,
|
||||
clock.Today,
|
||||
Titel: "Diploma",
|
||||
Auteur: "zorgprofessional",
|
||||
Taal: "nld",
|
||||
Bestandsnaam: fileName,
|
||||
Formaat: contentType,
|
||||
Inhoud: content);
|
||||
|
||||
return gateway.StoreDocumentAsync(request, ct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Acl.Application;
|
||||
|
||||
/// <summary>The fully default-filled diploma document the gateway will create in the ZGW Documenten
|
||||
/// API and relate to the zaak (S-10b). <see cref="Inhoud"/> is the raw file content; the gateway
|
||||
/// base64-encodes it into the ZGW <c>inhoud</c> field.</summary>
|
||||
public sealed record DocumentRequest(
|
||||
string Bronorganisatie,
|
||||
Uri Informatieobjecttype,
|
||||
string Vertrouwelijkheidaanduiding,
|
||||
Uri Zaak,
|
||||
DateOnly Creatiedatum,
|
||||
string Titel,
|
||||
string Auteur,
|
||||
string Taal,
|
||||
string Bestandsnaam,
|
||||
string Formaat,
|
||||
byte[] Inhoud);
|
||||
@@ -16,4 +16,11 @@ public interface IZaakGateway
|
||||
/// <summary>Read the zaak's <c>identificatie</c> — the public-safe reference the register shows.
|
||||
/// The Event Subscriber calls this through the ACL rather than reading ZGW itself (§8.1, #78).</summary>
|
||||
Task<string> GetZaakIdentificatieAsync(Uri zaakUrl, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Store a diploma document (S-10b): create an <c>enkelvoudiginformatieobject</c> in the ZGW
|
||||
/// Documenten API and relate it to the zaak via a <c>zaakinformatieobject</c>. Returns the URL of
|
||||
/// the created informatieobject.
|
||||
/// </summary>
|
||||
Task<Uri> StoreDocumentAsync(DocumentRequest request, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user