feat(#13): S-12b — Workflow Client user-tasks + Beoordelen userTask #83

Merged
not merged 7 commits from feat/13-workflow-user-tasks into main 2026-07-15 08:53:35 +00:00
3 changed files with 8 additions and 5 deletions
Showing only changes of commit 94a506cbfc - Show all commits

View File

@@ -87,8 +87,9 @@ try:
except Exception: except Exception:
d={} d={}
rid=os.environ['REG_ID'] rid=os.environ['REG_ID']
# Flowable's task-query returns the included process variables under 'variables'.
print(next((t['id'] for t in (d.get('data') or []) print(next((t['id'] for t in (d.get('data') or [])
if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('processVariables') or []))), ''))"; } if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('variables') or []))), ''))"; }
flcurl() { docker run --rm --network "$net" curlimages/curl:latest -fsS -u rest-admin:test "$@"; } flcurl() { docker run --rm --network "$net" curlimages/curl:latest -fsS -u rest-admin:test "$@"; }
query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","includeProcessVariables":true}' query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","includeProcessVariables":true}'

View File

@@ -137,11 +137,13 @@ public sealed class FlowableWorkflowClient(HttpClient http, FlowableOptions opti
private sealed record UserTaskDto( private sealed record UserTaskDto(
[property: JsonPropertyName("id")] string Id, [property: JsonPropertyName("id")] string Id,
[property: JsonPropertyName("processVariables")] IReadOnlyList<Variable>? ProcessVariables) // Flowable's task-query returns the (included) process variables under "variables", not
// "processVariables"; the request opts in via includeProcessVariables.
[property: JsonPropertyName("variables")] IReadOnlyList<Variable>? Variables)
{ {
/// <summary>The registration id this task carries as a process variable.</summary> /// <summary>The registration id this task carries as a process variable.</summary>
public string RegistrationId() => public string RegistrationId() =>
ProcessVariables?.SingleOrDefault(v => v.Name == "registrationId")?.Value Variables?.SingleOrDefault(v => v.Name == "registrationId")?.Value
?? throw new InvalidOperationException($"Beoordelen task {Id} carries no registrationId variable."); ?? throw new InvalidOperationException($"Beoordelen task {Id} carries no registrationId variable.");
} }

View File

@@ -158,7 +158,7 @@ public class FlowableWorkflowClientTests
var capture = new RequestCapture(); var capture = new RequestCapture();
var client = Client(capture.Responds(HttpStatusCode.OK, var client = Client(capture.Responds(HttpStatusCode.OK,
$$""" $$"""
{"data":[{"id":"task-1","processVariables":[{"name":"registrationId","type":"string","value":"{{rid}}"}]}],"total":1} {"data":[{"id":"task-1","variables":[{"name":"registrationId","type":"string","value":"{{rid}}"}]}],"total":1}
""")); """));
var tasks = await client.GetOpenBeoordelingenAsync(); var tasks = await client.GetOpenBeoordelingenAsync();
@@ -192,7 +192,7 @@ public class FlowableWorkflowClientTests
{ {
var capture = new RequestCapture(); var capture = new RequestCapture();
var client = Client(capture.Responds(HttpStatusCode.OK, var client = Client(capture.Responds(HttpStatusCode.OK,
"""{"data":[{"id":"task-1","processVariables":[]}],"total":1}""")); """{"data":[{"id":"task-1","variables":[]}],"total":1}"""));
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => client.GetOpenBeoordelingenAsync()); var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => client.GetOpenBeoordelingenAsync());
Assert.Contains("task-1", ex.Message); Assert.Contains("task-1", ex.Message);