feat(domain): the werkbak lists only registrations still open for beoordeling (refs #12)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-16 11:20:43 +02:00
parent 345191b1df
commit 435db81bdf

View File

@@ -1,3 +1,5 @@
using Big.Domain;
namespace Big.Application; namespace Big.Application;
/// <summary>One row of the behandelaar's werkbak: a registration awaiting beoordeling, with the /// <summary>One row of the behandelaar's werkbak: a registration awaiting beoordeling, with the
@@ -8,7 +10,8 @@ public sealed record WerkbakItem(string RegistrationId, string Bsn, string Statu
/// The werkbak query (S-12c): the registrations awaiting a behandelaar's beoordeling. It reads the /// The werkbak query (S-12c): the registrations awaiting a behandelaar's beoordeling. It reads the
/// open <c>Beoordelen</c> tasks from the workflow engine (§8.2, via <see cref="IUserTaskClient"/>) — /// open <c>Beoordelen</c> tasks from the workflow engine (§8.2, via <see cref="IUserTaskClient"/>) —
/// the authoritative set of work items — and enriches each with its aggregate (bsn + status). A task /// the authoritative set of work items — and enriches each with its aggregate (bsn + status). A task
/// whose registration the domain doesn't know is skipped rather than invented. /// whose registration the domain doesn't know, or whose registration is no longer open for beoordeling
/// (e.g. withdrawn — S-11 — while its task lingers until the workflow cancels it), is skipped.
/// </summary> /// </summary>
public sealed class Werkbak(IUserTaskClient tasks, IRegistrationStore store) public sealed class Werkbak(IUserTaskClient tasks, IRegistrationStore store)
{ {
@@ -20,7 +23,7 @@ public sealed class Werkbak(IUserTaskClient tasks, IRegistrationStore store)
foreach (var task in open) foreach (var task in open)
{ {
var registration = await store.GetAsync(task.RegistrationId, ct); var registration = await store.GetAsync(task.RegistrationId, ct);
if (registration is null) if (registration is null || !IsOpenForBeoordeling(registration.Status))
continue; continue;
items.Add(new WerkbakItem( items.Add(new WerkbakItem(
@@ -29,4 +32,9 @@ public sealed class Werkbak(IUserTaskClient tasks, IRegistrationStore store)
return items; return items;
} }
// Only registrations still open for a decision belong in the werkbak; a terminal one (decided or
// withdrawn — S-11) whose Beoordelen task has not yet been cleared must not surface to a behandelaar.
private static bool IsOpenForBeoordeling(RegistrationStatus status)
=> status is RegistrationStatus.Ingediend or RegistrationStatus.InBehandeling;
} }