diff --git a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs index eb9c69da..7b297886 100644 --- a/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs +++ b/src/ConductorSharp.Engine/Builders/HumanTaskBuilder.cs @@ -10,21 +10,21 @@ namespace ConductorSharp.Engine.Builders { public static class HumanTaskExtensions { - public static ITaskOptionsBuilder AddTask( + public static ITaskOptionsBuilder AddTask( this ITaskSequenceBuilder builder, - Expression> reference, - Expression> input + Expression>> reference, + Expression>> input ) where TWorkflow : ITypedWorkflow { - var taskBuilder = new HumanTaskBuilder(reference.Body, input.Body, builder.BuildConfiguration); + var taskBuilder = new HumanTaskBuilder(reference.Body, input.Body, builder.BuildConfiguration); builder.AddTaskBuilderToSequence(taskBuilder); return taskBuilder; } } - internal class HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) - : BaseTaskBuilder(taskExpression, inputExpression, buildConfiguration) + internal class HumanTaskBuilder(Expression taskExpression, Expression inputExpression, BuildConfiguration buildConfiguration) + : BaseTaskBuilder, TOutput>(taskExpression, inputExpression, buildConfiguration) { public override WorkflowTask[] Build() => [ diff --git a/src/ConductorSharp.Engine/Model/HumanTaskModel.cs b/src/ConductorSharp.Engine/Model/HumanTaskModel.cs index 0b9d2010..1e6dbeb6 100644 --- a/src/ConductorSharp.Engine/Model/HumanTaskModel.cs +++ b/src/ConductorSharp.Engine/Model/HumanTaskModel.cs @@ -3,7 +3,7 @@ namespace ConductorSharp.Engine.Model { - public class HumanTaskInput : IRequest { } + public class HumanTaskInput : IRequest { } - public class HumanTaskModel : TaskModel { } + public class HumanTaskModel : TaskModel, TOutput> { } } diff --git a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj index 1d5db5ba..3018c56a 100644 --- a/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj +++ b/test/ConductorSharp.Engine.Tests/ConductorSharp.Engine.Tests.csproj @@ -19,7 +19,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs index 035cec47..0d35c3e3 100644 --- a/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs +++ b/test/ConductorSharp.Engine.Tests/Integration/WorkflowBuilderTests.cs @@ -188,7 +188,7 @@ public void BuilderReturnsCorrectDefinitionPassthroughTaskWorkflow() public void BuilderReturnsCorrectDefinitionHumanWorkflow() { var definition = GetDefinitionFromWorkflow(); - var expectedDefinition = EmbeddedFileHelper.GetLinesFromEmbeddedFile("~/Samples/Workflows/HumanTask.json"); + var expectedDefinition = EmbeddedFileHelper.GetLinesFromEmbeddedFile("~/Samples/Workflows/HumanTaskWorkflow.json"); Assert.Equal(expectedDefinition, definition); } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.cs b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.cs index 163aeb43..8446c9dd 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.cs +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.cs @@ -12,7 +12,13 @@ public class HumanTaskWorkflowOutput : WorkflowOutput { } public class HumanTaskWorkflow : Workflow { - public HumanTaskModel HumanTask { get; set; } + public class HumanTaskOutput + { + public string CustomerId { get; set; } + } + + public HumanTaskModel HumanTask { get; set; } + public CustomerGetV1 GetCustomer { get; set; } public HumanTaskWorkflow(WorkflowDefinitionBuilder builder) : base(builder) { } @@ -22,6 +28,7 @@ public override void BuildDefinition() base.BuildDefinition(); _builder.AddTask(wf => wf.HumanTask, wf => new() { }); + _builder.AddTask(wf => wf.GetCustomer, wf => new() { CustomerId = wf.HumanTask.Output.CustomerId }); } } } diff --git a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.json similarity index 56% rename from test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json rename to test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.json index 2c1d63a6..c681fe2b 100644 --- a/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTask.json +++ b/test/ConductorSharp.Engine.Tests/Samples/Workflows/HumanTaskWorkflow.json @@ -8,6 +8,16 @@ "inputParameters": {}, "type": "HUMAN", "workflowTaskType": "HUMAN" + }, + { + "name": "CUSTOMER_get", + "taskReferenceName": "get_customer", + "inputParameters": { + "customer_id": "${human_task.output.customer_id}" + }, + "type": "SIMPLE", + "optional": false, + "workflowTaskType": "SIMPLE" } ], "inputParameters": [],