using FastEndpoints; using FrameworkBLL.Dashboard; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Dashboard { public class GetSelectListDashboard : BaseEndpoint> { private readonly IDashboardBLL _DashboardBLL; public GetSelectListDashboard(IDashboardBLL DashboardBLL) { _DashboardBLL = DashboardBLL; } public override void Configure() { Post("/Dashboard/GetSelectListDashboard"); AllowAnonymous(); } public record GetSelectListDashboardParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetSelectListDashboardParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _DashboardBLL.GetSelectListDashboard(req.CriteriaDTO, LoginDTO!, ct); 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); } } } }