using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using WiBLL.Workstation; using static GB5Shared.GB5Constant.Constant; namespace WiSL.EndPoints.Workstation; public class GetSelectListWorkstation : BaseEndpoint> { private readonly IWorkstationBLL _bll; public GetSelectListWorkstation(IWorkstationBLL bll) => _bll = bll; public override void Configure() { Post("/Workstation/GetSelectListWorkstation"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult); protected override string? GetCacheKey(Parameters req, LoginDTO loginDTO) => KeyGenerator.KeyGeneration(req.CriteriaDTO, req.FirstNumber, CacheKeyLevel.CLIENT_LEVEL, loginDTO); protected override async Task> ExecuteAsync( Parameters req, LoginDTO loginDTO, CancellationToken ct) { var result = await _bll.GetSelectListWorkstation( req.FirstNumber, req.MaxResult, req.CriteriaDTO, loginDTO); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } }