using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.TimeSlip; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.TimeSlip { public class SelectList : BaseEndpoint> { private readonly ITimeSlipBLL _TimeSlipBLL; public SelectList(ITimeSlipBLL ITimeSlipBLL) { _TimeSlipBLL = ITimeSlipBLL; } public override void Configure() { Post("/TimeSlip/SelectList"); AllowAnonymous(); } public record SelectListParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(SelectListParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _TimeSlipBLL.SelectList(req.FirstNumber, req.MaxResult, req.CriteriaDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }