using System.Text.Json; using FastEndpoints; using FrameworkBLL.WorkFlow; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using GB5Shared.DateConverter; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.WorkFlow { public class WorkflowStatus : BaseEndpoint> { private readonly IWorkFlowBLL _IWorkFlowBLL; public WorkflowStatus(IWorkFlowBLL IWorkFlowBLL) { _IWorkFlowBLL = IWorkFlowBLL; } public override void Configure() { Post("/WorkFlow/WorkflowStatus"); AllowAnonymous(); } public record WorkflowStatusParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(WorkflowStatusParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _IWorkFlowBLL.WorkFlowStatus(req.CriteriaDTO, LoginDTO); var options = new JsonSerializerOptions { PropertyNamingPolicy = null }; options.AddGB5Converters(); string json = JsonSerializer.Serialize(result, options); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(json, CacheKeyLevel.NotRequired, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NotRequired, LoginDTO, ex.Message, 500); } } } }