- Added endpoints for managing form definitions including: - GetFormDefinitionById - GetFormDefinitionList - PublishFormDefinition - SubmitFormData - UpdateFormDefinition - Added endpoints for managing workflow definitions including: - CreateWorkflowDefinition - DeleteWorkflowDefinition - DisableWorkflowDefinition - GetWorkflowDefinitionById - GetWorkflowDefinitionList - PublishWorkflowDefinition - UpdateWorkflowDefinition - Added endpoints for managing workflow instances including: - GetWorkflowInstanceById - GetWorkflowInstanceList - MonitorWorkflowInstances - ResumeWorkflowInstance - StartWorkflowInstance - SuspendWorkflowInstance - WithdrawWorkflowInstance - Added endpoints for managing workflow tasks including: - ApproveTask - DelegateTask - GetCcTasks - GetHistoryTasks - GetOverdueTasks - GetPendingTasks - GetTaskById - RejectTask - TransferTask - UrgeTask - Introduced middleware for handling API responses and global exceptions. - Configured application settings for database connection and JWT authentication.
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using FastEndpoints;
|
|
using MediatR;
|
|
using Workflow.Application.Features.WorkflowDefinitions.Commands;
|
|
using Workflow.Application.Features.WorkflowDefinitions.DTOs;
|
|
|
|
namespace Workflow.Api.Endpoints.WorkflowDefinition;
|
|
|
|
public class CreateWorkflowDefinitionEndpoint : Endpoint<CreateWorkflowDefinitionRequest, WorkflowDefinitionDto>
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public CreateWorkflowDefinitionEndpoint(IMediator mediator) => _mediator = mediator;
|
|
|
|
public override void Configure()
|
|
{
|
|
Post("/workflow-definitions");
|
|
AllowAnonymous();
|
|
Summary(s =>
|
|
{
|
|
s.Summary = "Create a new workflow definition";
|
|
});
|
|
}
|
|
|
|
public override async Task HandleAsync(CreateWorkflowDefinitionRequest req, CancellationToken ct)
|
|
{
|
|
var command = new CreateWorkflowDefinitionCommand(req.Name, req.Code, req.Description);
|
|
var result = await _mediator.Send(command, ct);
|
|
await SendAsync(result, 200, ct);
|
|
}
|
|
}
|
|
|
|
public class CreateWorkflowDefinitionRequest
|
|
{
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Code { get; set; } = string.Empty;
|
|
public string? Description { get; set; }
|
|
}
|