diff --git a/e-suite.API/eSuite.API/Program.cs b/e-suite.API/eSuite.API/Program.cs index 3f8e73f..5b9fc0b 100644 --- a/e-suite.API/eSuite.API/Program.cs +++ b/e-suite.API/eSuite.API/Program.cs @@ -42,6 +42,11 @@ builder.Services.AddControllersWithViews() .AddJsonOptions(options => { options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + //todo add support for OneOf + //Add the OneOf nuget package, before uncommenting this, to allow properties to be mapped to public Oneof test {get;set;} + //options.JsonSerializerOptions.Converters.Add(new OneOf.OneOfJsonConverter());//todo add support for OneOf + //Add the OneOf nuget package, before uncommenting this, to allow properties to be mapped to public Oneof test {get;set;} + //options.JsonSerializerOptions.Converters.Add(new OneOf.OneOfJsonConverter()); options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; }); builder.AddSwagger(); diff --git a/e-suite.Workflow.Core/Interfaces/IFormTemplate.cs b/e-suite.Workflow.Core/Interfaces/IFormTemplate.cs new file mode 100644 index 0000000..0d70d12 --- /dev/null +++ b/e-suite.Workflow.Core/Interfaces/IFormTemplate.cs @@ -0,0 +1,10 @@ +using e_suite.Workflow.Core.Attributes; + +namespace e_suite.Workflow.Core.Interfaces; + +[TaskCapability] +public interface IFormTemplate +{ + public bool IsMultiple { get; set; } + IEnumerable ValidateForTemplate(); +} \ No newline at end of file diff --git a/e-suite.Workflow.Core/Interfaces/ITask.cs b/e-suite.Workflow.Core/Interfaces/ITask.cs index e65406a..886c2f6 100644 --- a/e-suite.Workflow.Core/Interfaces/ITask.cs +++ b/e-suite.Workflow.Core/Interfaces/ITask.cs @@ -1,5 +1,8 @@ -namespace e_suite.Workflow.Core.Interfaces; +using e_suite.Workflow.Core.Attributes; +namespace e_suite.Workflow.Core.Interfaces; + +[TaskCapability] public interface ITask { /// @@ -25,8 +28,8 @@ public interface ITask /// /// List of tasks that need to be completed before this on can start. (If empty, will start when the workflow starts) /// - ITask? Predecessor { get; set; } - + List Predecessors { get; set; } + //Todo can only be on a run-time instance ///// ///// Called when the task status has been progressed from Pending to Active. diff --git a/e-suite.Workflow.Core/TaskBase.cs b/e-suite.Workflow.Core/TaskBase.cs index 0e75863..cb2236d 100644 --- a/e-suite.Workflow.Core/TaskBase.cs +++ b/e-suite.Workflow.Core/TaskBase.cs @@ -9,7 +9,7 @@ public abstract class TaskBase : ITask, IBudget, ITags public required ITask Parent { get; set; } public required string Name { get; set; } public string Description { get; set; } = string.Empty; - public ITask? Predecessor { get; set; } + public List Predecessors { get; set; } = []; public decimal UnitsOfWork { get; set; } = 1; public required Cost Cost { get; set; } public BudgetOption BudgetOption { get; set; } = BudgetOption.DoNotShow; diff --git a/e-suite.Workflow.Core/Tasks/BasicTask.cs b/e-suite.Workflow.Core/Tasks/BasicTask.cs index f66f90f..6ff17c4 100644 --- a/e-suite.Workflow.Core/Tasks/BasicTask.cs +++ b/e-suite.Workflow.Core/Tasks/BasicTask.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using e_suite.Workflow.Core.Attributes; +using e_suite.Workflow.Core.Interfaces; namespace e_suite.Workflow.Core.Tasks; @@ -7,7 +8,7 @@ namespace e_suite.Workflow.Core.Tasks; /// A user has to open this task, manually set it to ready to complete /// [GeneralTask] -public class BasicTask : TaskBase +public class BasicTask : TaskBase, IAssignees { - + public IList Assignees { get; } } \ No newline at end of file diff --git a/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs b/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs index 0452175..a2fc7f2 100644 --- a/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs +++ b/e-suite.Workflow.Core/Tasks/FormDataInputTask.cs @@ -4,19 +4,11 @@ using eSuite.Core.Miscellaneous; namespace e_suite.Workflow.Core.Tasks; -public interface ITemplateValidatable -{ - IEnumerable ValidateForTemplate(); -} - - - [GeneralTask] -public class FormDataInputTask : TaskBase, IAssignees, ITemplateValidatable +public class FormDataInputTask : TaskBase, IAssignees, IFormTemplate { public IList Assignees { get; } = new List(); public bool IsMultiple { get; set; } - public bool ContainsDecision { get; set; } public required IGeneralIdRef FormIdRef { get; set; } public IEnumerable ValidateForTemplate()