From 435db81bdf6cb8a3fcb3f875832db33d84e240e7 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Thu, 16 Jul 2026 11:20:43 +0200 Subject: [PATCH] feat(domain): the werkbak lists only registrations still open for beoordeling (refs #12) Co-Authored-By: Claude Opus 4.8 (1M context) --- services/domain/Big.Application/Werkbak.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/domain/Big.Application/Werkbak.cs b/services/domain/Big.Application/Werkbak.cs index 4275d50..dfd6cf8 100644 --- a/services/domain/Big.Application/Werkbak.cs +++ b/services/domain/Big.Application/Werkbak.cs @@ -1,3 +1,5 @@ +using Big.Domain; + namespace Big.Application; /// 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 /// open Beoordelen tasks from the workflow engine (§8.2, via ) — /// 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. /// 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) { var registration = await store.GetAsync(task.RegistrationId, ct); - if (registration is null) + if (registration is null || !IsOpenForBeoordeling(registration.Status)) continue; items.Add(new WerkbakItem( @@ -29,4 +32,9 @@ public sealed class Werkbak(IUserTaskClient tasks, IRegistrationStore store) 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; }