using FastEndpoints; using FrameworkBLL.CommandPanel; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using System; using System.Threading; using System.Threading.Tasks; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.CommandPanel { // Full-row load for gbcommandpalette.component.ts — replaces the static gbcommandpalette.json // bundle it currently imports at compile time. public class GetAllCommandPanel : BaseEndpoint { private readonly ICommandPanelBLL _commandPanelBLL; public GetAllCommandPanel(ICommandPanelBLL commandPanelBLL) { _commandPanelBLL = commandPanelBLL; } public override void Configure() { Get("/CommandPanel/GetAllCommandPanel"); AllowAnonymous(); } public record GetAllCommandPanelParameters([property: FromHeader] string Login); protected override async Task> ExecuteAsync(GetAllCommandPanelParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _commandPanelBLL.GetAllCommandPanel(loginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, loginDTO, ex.Message, 500); } } } }