using FastEndpoints; using DevadminBLL.ReportFormat; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace DevadminSL.EndPoints.ReportFormat { public class GetSelectListReportFormat : BaseEndpoint> { private readonly IReportFormatBLL _reportFormatBLL; public GetSelectListReportFormat(IReportFormatBLL reportFormatBLL) { _reportFormatBLL = reportFormatBLL; } public override void Configure() { Post("/ReportFormat/GetSelectListReportFormat"); AllowAnonymous(); } public record GetSelectListReportFormatParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync( GetSelectListReportFormatParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _reportFormatBLL.GetSelectListReportFormat( 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 ); } } } }