diff --git a/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IWorkflowRepository.cs b/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IWorkflowRepository.cs index 5f122a3..4ae9111 100644 --- a/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IWorkflowRepository.cs +++ b/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IWorkflowRepository.cs @@ -14,4 +14,24 @@ public interface IWorkflowRepository : IRepository /// Cancellation token. /// Workflow data grouped by source. Task GetByWisagIdAsync(int wisagId, CancellationToken cancellationToken); + + /// + /// Closes a workflow item and returns procedure result code/message. + /// + /// Internal user identifier expected by the procedure. + /// Source system identifier. + /// Process identifier. + /// Closing method identifier. + /// Optional comment. + /// Optional rejection reason identifier. + /// Cancellation token. + /// Close operation result. + Task CloseAsync( + int userId, + string source, + long processId, + int closingMethodId, + string? comment, + byte? rejectionReasonId, + CancellationToken cancellationToken); } diff --git a/src/core/DigitalData.TaskFlow.Domain/ProcedureResults/WorkflowClosing.cs b/src/core/DigitalData.TaskFlow.Domain/ProcedureResults/WorkflowClosing.cs new file mode 100644 index 0000000..b01d7fc --- /dev/null +++ b/src/core/DigitalData.TaskFlow.Domain/ProcedureResults/WorkflowClosing.cs @@ -0,0 +1,5 @@ +namespace DigitalData.TaskFlow.Domain.ProcedureResults; + +public sealed class WorkflowClosing : ProcedureResultBase +{ +} diff --git a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Persistence/TaskFlowDbContext.cs b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Persistence/TaskFlowDbContext.cs index 20b3bc1..3f406fc 100644 --- a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Persistence/TaskFlowDbContext.cs +++ b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Persistence/TaskFlowDbContext.cs @@ -18,6 +18,11 @@ public sealed class TaskFlowDbContext(DbContextOptions option /// public DbSet Documents => Set(); + /// + /// Gets the keyless result model used for workflow close procedure results. + /// + public DbSet WorkflowClosings => Set(); + protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); @@ -37,5 +42,13 @@ public sealed class TaskFlowDbContext(DbContextOptions option entity.Property(x => x.Code).HasColumnName("CODE").HasColumnType("int"); entity.Property(x => x.Result).HasColumnName("RESULT").HasColumnType("nvarchar(max)"); }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + entity.ToView(null); + entity.Property(x => x.Code).HasColumnName("CODE").HasColumnType("int"); + entity.Property(x => x.Result).HasColumnName("RESULT").HasColumnType("nvarchar(400)"); + }); } }