feat(#13): S-12c-2 — behandel decide → domain + complete workflow task (#86)
All checks were successful
All checks were successful
## What & why
Second half of **S-12c** (behandel-portal backend), completing the decision path per **ADR-0013**:
- **Domain:** `BeoordeelRegistratie` now, after applying the decision (aggregate + ACL for approval), **completes the open Flowable `Beoordelen` task** for that registration (found by registrationId) with the besluit, so the workflow advances. No open task → the decision still stands (completes nothing); idempotent.
- **BFF:** `POST /behandel/registrations/{id}/decide` behind the medewerker/`behandelaar` policy, forwarding `goedkeuren`/`afwijzen` to the domain. Validates the besluit vocabulary (400 on unknown) without troubling the domain.
Behavior: decide is **401** without a token, **403** without the role, **400** for an unknown besluit, **204** (forwarded) for a behandelaar.
This completes the behandel backend. **S-12d** (the Angular behandel-portal + Playwright e2e) closes umbrella #13 and retires the temporary `/approve`.
## Definition of Done
- [x] Linked issue: #13 (umbrella, `refs`)
- [x] Tests first; red → green per layer
- [x] Unit + acceptance green (`make unit`): domain 79, bff 27, acceptance 9 (acl/event-subscriber unaffected)
- [x] Beoordeling acceptance scenario asserts task completion (goedkeuren + afwijzen)
- [x] openapi.json + api-client regenerated (drift guard passes)
- [x] Mutation ≥ break(90): **domain 100%, bff 100%**
- [ ] CI green (pending)
Part of #13.
Reviewed-on: #86
This commit was merged in pull request #86.
This commit is contained in:
@@ -15,6 +15,7 @@ Feature: Een registratie beoordelen
|
||||
When the behandelaar decides "goedkeuren"
|
||||
Then the registration has status "INGESCHREVEN"
|
||||
And the zaak's final status is set via the ACL
|
||||
And the beoordeling task is completed with "goedkeuren"
|
||||
|
||||
Scenario: Afwijzen wijst de registratie af zonder de ACL
|
||||
Given a submitted registration with an opened zaak
|
||||
@@ -22,3 +23,4 @@ Feature: Een registratie beoordelen
|
||||
And the behandelaar decides "afwijzen"
|
||||
Then the registration has status "AFGEWEZEN"
|
||||
And the ACL is not asked to set the zaak status
|
||||
And the beoordeling task is completed with "afwijzen"
|
||||
|
||||
@@ -16,6 +16,7 @@ public sealed class EenRegistratieBeoordelenSteps
|
||||
{
|
||||
private readonly InMemoryAclClient _acl = new();
|
||||
private readonly InMemoryRegistrationStore _store = new();
|
||||
private readonly InMemoryUserTaskClient _tasks = new();
|
||||
private RegistrationId _id;
|
||||
|
||||
[Given("a submitted registration with an opened zaak")]
|
||||
@@ -25,6 +26,8 @@ public sealed class EenRegistratieBeoordelenSteps
|
||||
registration.AttachZaak(InMemoryAclClient.OpenedZaakUrl);
|
||||
await _store.SaveAsync(registration);
|
||||
_id = registration.Id;
|
||||
// The process has parked at the Beoordelen user task awaiting the behandelaar.
|
||||
_tasks.Open(_id);
|
||||
}
|
||||
|
||||
[When("the behandelaar takes it into behandeling")]
|
||||
@@ -37,7 +40,7 @@ public sealed class EenRegistratieBeoordelenSteps
|
||||
|
||||
[When("the behandelaar decides \"(.*)\"")]
|
||||
public async Task WhenTheBehandelaarDecides(string besluit)
|
||||
=> await new BeoordeelRegistratie(_store, _acl).HandleAsync(
|
||||
=> await new BeoordeelRegistratie(_store, _acl, _tasks).HandleAsync(
|
||||
new BeoordeelRegistratieCommand(_id, Enum.Parse<BeoordelingsBesluit>(besluit, ignoreCase: true)));
|
||||
|
||||
[Then("the registration has status \"(.*)\"")]
|
||||
@@ -55,4 +58,8 @@ public sealed class EenRegistratieBeoordelenSteps
|
||||
[Then("the ACL is not asked to set the zaak status")]
|
||||
public void ThenTheAclIsNotAskedToSetTheZaakStatus()
|
||||
=> Assert.Null(_acl.ApprovedZaakUrl);
|
||||
|
||||
[Then("the beoordeling task is completed with \"(.*)\"")]
|
||||
public void ThenTheBeoordelingTaskIsCompletedWith(string besluit)
|
||||
=> Assert.Equal(Enum.Parse<BeoordelingsBesluit>(besluit, ignoreCase: true), _tasks.Completed?.Besluit);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ public sealed class CapturingDomainClient : IDomainClient
|
||||
|
||||
public Task<IReadOnlyList<WerkbakItem>> GetWerkbakAsync(CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<WerkbakItem>>([]);
|
||||
|
||||
public Task DecideAsync(string registrationId, string besluit, CancellationToken ct = default)
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>Serves configurable projection rows.</summary>
|
||||
|
||||
@@ -43,6 +43,29 @@ public sealed class InMemoryAclClient : IAclClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>An in-memory user-task client for the beoordeling acceptance scenario: it holds one open
|
||||
/// Beoordelen task per registration and records the besluit each is completed with.</summary>
|
||||
public sealed class InMemoryUserTaskClient : IUserTaskClient
|
||||
{
|
||||
private readonly List<BeoordelingTask> _open = [];
|
||||
|
||||
public (string TaskId, BeoordelingsBesluit Besluit)? Completed { get; private set; }
|
||||
|
||||
public void Open(RegistrationId registrationId) => _open.Add(new BeoordelingTask($"task-{registrationId}", registrationId));
|
||||
|
||||
public Task<IReadOnlyList<BeoordelingTask>> GetOpenBeoordelingenAsync(CancellationToken ct = default)
|
||||
=> Task.FromResult<IReadOnlyList<BeoordelingTask>>(_open);
|
||||
|
||||
public Task ClaimAsync(string taskId, string behandelaar, CancellationToken ct = default) => Task.CompletedTask;
|
||||
|
||||
public Task CompleteBeoordelingAsync(string taskId, BeoordelingsBesluit besluit, CancellationToken ct = default)
|
||||
{
|
||||
Completed = (taskId, besluit);
|
||||
_open.RemoveAll(t => t.TaskId == taskId);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>An in-memory registration store for the domain acceptance scenario.</summary>
|
||||
public sealed class InMemoryRegistrationStore : IRegistrationStore
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user