using AccountsBLL.WarehouseFact; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.WarehouseFact { // Lists all registered fact tables (FSALE, FFINANCE, ...) — the admin-UI grid backing // GetWarehouseFact (single-row) above. public class GetWarehouseFactList : BaseEndpoint> { private readonly IWarehouseFactBLL _WarehouseFactBLL; public GetWarehouseFactList(IWarehouseFactBLL WarehouseFactBLL) { _WarehouseFactBLL = WarehouseFactBLL; } public override void Configure() { Get("/Warehouse/GetWarehouseFactList"); AllowAnonymous(); } public record GetWarehouseFactListParameters( [property: FromHeader] string Login ); protected override async Task> ExecuteAsync(GetWarehouseFactListParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _WarehouseFactBLL.GetWarehouseFactList(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); } } } }