using FastEndpoints; using FrameworkBLL.Promotion; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Promotion { // TODO: gate with [MenuRights] once a real menu row exists for this admin screen. public class GetPromotionCounterpartyList : BaseEndpoint> { private readonly IPromotionCounterpartyBLL _BLL; public GetPromotionCounterpartyList(IPromotionCounterpartyBLL bll) => _BLL = bll; public override void Configure() { Get("/PromotionCounterparty/GetPromotionCounterpartyList"); AllowAnonymous(); } public record Parameters([property: FromHeader] string Login); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(Parameters req, LoginDTO login, CancellationToken ct) { var result = await _BLL.GetPromotionCounterpartyList(login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, login); } } }