using FrameworkBLL.DocumentSet; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; using FastEndpoints; using System.Threading; using System.Threading.Tasks; namespace FrameworkSL.Endpoints.DocumentSet { public class GetSelectListDocumentSet : BaseEndpoint> { private readonly IDocumentSetBLL _documentSetBLL; public GetSelectListDocumentSet(IDocumentSetBLL documentSetBLL) { _documentSetBLL = documentSetBLL; } public override void Configure() { Post("/DocumentSet/GetSelectListDocumentSet"); AllowAnonymous(); } public record GetSelectListDocumentSetParameters( [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult, [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListDocumentSetParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _documentSetBLL.GetSelectListDocumentSet( 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 ); } } } }