using System; using System.Threading; using System.Threading.Tasks; using FastEndpoints; using FrameworkBLL.SystemJob; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.SystemJob { public class GetListSystemJob : BaseEndpoint> { private readonly ISystemJobBLL _SystemJobBLL; public GetListSystemJob(ISystemJobBLL systemJobBLL) { _SystemJobBLL = systemJobBLL; } public override void Configure() { Post("/SystemJob/GetListSystemJob"); AllowAnonymous(); } public record GetListSystemJobParameters( [property: FromHeader] string Login, [property: QueryParam] int? RunStatus, [property: QueryParam] string SysJobType, [property: QueryParam] string QueueName, [property: QueryParam] DateTime? DateFrom, [property: QueryParam] DateTime? DateTo, [property: QueryParam] string SearchText, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(GetListSystemJobParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _SystemJobBLL.GetListSystemJob( req.RunStatus, req.SysJobType, req.QueueName, req.DateFrom, req.DateTo, req.SearchText, req.FirstNumber, req.MaxResult, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }