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 static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.WorkFlow { public class WorkflowHistory : BaseEndpoint> { private readonly IWorkFlowBLL _IWorkFlowBLL; public WorkflowHistory(IWorkFlowBLL IWorkFlowBLL) { _IWorkFlowBLL = IWorkFlowBLL; } public override void Configure() { Post("/WorkFlow/WorkflowHistory"); AllowAnonymous(); } public record WorkflowHistoryParameters( [property: FromHeader] string Login, [property: QueryParam] int WorkflowType, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(WorkflowHistoryParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _IWorkFlowBLL.WorkFlowHistory(req.WorkflowType, req.CriteriaDTO, LoginDTO); //var options = new JsonSerializerOptions //{ // PropertyNamingPolicy = null //}; //options.Converters.Add(new EpochDateTimeConverter()); //options.Converters.Add(new NullableEpochDateTimeConverter()); //string json = JsonSerializer.Serialize(result, options); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NotRequired, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NotRequired, LoginDTO, ex.Message, 500); } } } }