using FastEndpoints; using GB5Shared.DaprCache; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Allocation; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Allocation { public class GetPendingSelectList : BaseEndpoint> { private readonly IPendingAllocationBLL _bll; public GetPendingSelectList(IPendingAllocationBLL bll) => _bll = bll; public override void Configure() { Post("/Allocation/SelectList"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] string? SearchText = null, [property: QueryParam] int PageOffset = 0, [property: QueryParam] int PageSize = 200 ); //protected override string? GetCacheKey(Params req, LoginDTO login) //{ // try // { // return KeyGenerator.KeyGeneration( // req.CriteriaDTO, // req.PageOffset, // CacheKeyLevel.CLIENT_LEVEL, // login); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync( Params req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetSelectListTPendingAllocation( req.CriteriaDTO, req.SearchText, req.PageOffset, req.PageSize, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } } }