Add CloseAsync method and WorkflowClosing entity
Introduced a new method `CloseAsync` in the `IWorkflowRepository` interface to handle workflow item closure and return a procedure result. Added a new class `WorkflowClosing` in `WorkflowClosing.cs` as a sealed class inheriting from `ProcedureResultBase`. Updated `TaskFlowDbContext` to include a `DbSet<WorkflowClosing>` for keyless workflow close procedure results. Configured the `WorkflowClosing` entity in `OnModelCreating` with specific column mappings and a maximum length for the `Result` property.
This commit is contained in:
@@ -14,4 +14,24 @@ public interface IWorkflowRepository : IRepository
|
|||||||
/// <param name="cancellationToken">Cancellation token.</param>
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
/// <returns>Workflow data grouped by source.</returns>
|
/// <returns>Workflow data grouped by source.</returns>
|
||||||
Task<Workflow?> GetByWisagIdAsync(int wisagId, CancellationToken cancellationToken);
|
Task<Workflow?> GetByWisagIdAsync(int wisagId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes a workflow item and returns procedure result code/message.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">Internal user identifier expected by the procedure.</param>
|
||||||
|
/// <param name="source">Source system identifier.</param>
|
||||||
|
/// <param name="processId">Process identifier.</param>
|
||||||
|
/// <param name="closingMethodId">Closing method identifier.</param>
|
||||||
|
/// <param name="comment">Optional comment.</param>
|
||||||
|
/// <param name="rejectionReasonId">Optional rejection reason identifier.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>Close operation result.</returns>
|
||||||
|
Task<WorkflowClosing?> CloseAsync(
|
||||||
|
int userId,
|
||||||
|
string source,
|
||||||
|
long processId,
|
||||||
|
int closingMethodId,
|
||||||
|
string? comment,
|
||||||
|
byte? rejectionReasonId,
|
||||||
|
CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace DigitalData.TaskFlow.Domain.ProcedureResults;
|
||||||
|
|
||||||
|
public sealed class WorkflowClosing : ProcedureResultBase
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -18,6 +18,11 @@ public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> option
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DbSet<Document> Documents => Set<Document>();
|
public DbSet<Document> Documents => Set<Document>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the keyless result model used for workflow close procedure results.
|
||||||
|
/// </summary>
|
||||||
|
public DbSet<WorkflowClosing> WorkflowClosings => Set<WorkflowClosing>();
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
@@ -37,5 +42,13 @@ public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> option
|
|||||||
entity.Property(x => x.Code).HasColumnName("CODE").HasColumnType("int");
|
entity.Property(x => x.Code).HasColumnName("CODE").HasColumnType("int");
|
||||||
entity.Property(x => x.Result).HasColumnName("RESULT").HasColumnType("nvarchar(max)");
|
entity.Property(x => x.Result).HasColumnName("RESULT").HasColumnType("nvarchar(max)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WorkflowClosing>(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)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user