feat(domain): implement SubmitRegistration and OpenZaakWorker (refs #6)
SubmitRegistration creates the aggregate, persists it, starts the registratie process via the Workflow Client, records the instance id and upserts. OpenZaakWorker loads the correlated registration, opens a zaak via the ACL, attaches it and saves; an unknown registration throws (job redelivered), and an already-opened zaak short- circuits without opening a second one (§8.6). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,17 @@ public sealed class OpenZaakWorker(IRegistrationStore store, IAclClient acl)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(job);
|
||||
|
||||
// STUB (red): does not load, call the ACL, or attach.
|
||||
await Task.CompletedTask;
|
||||
return new Uri("about:blank");
|
||||
var registration = await store.GetAsync(job.RegistrationId, ct)
|
||||
?? throw new InvalidOperationException(
|
||||
$"No registration {job.RegistrationId} for OpenZaakAanmaken job {job.JobId}.");
|
||||
|
||||
// A redelivered job whose zaak was already opened completes without opening a second one.
|
||||
if (registration.ZaakUrl is not null)
|
||||
return registration.ZaakUrl;
|
||||
|
||||
var zaakUrl = await acl.OpenZaakAsync(registration.Bsn, ct);
|
||||
registration.AttachZaak(zaakUrl);
|
||||
await store.SaveAsync(registration, ct);
|
||||
return zaakUrl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user