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 — // same deferred pattern as ProvisionIngestFlow's own TODO (see the plan doc). public class GetPromotionCounterparty : BaseEndpoint> { private readonly IPromotionCounterpartyBLL _BLL; public GetPromotionCounterparty(IPromotionCounterpartyBLL bll) => _BLL = bll; public override void Configure() { Get("/PromotionCounterparty/GetPromotionCounterparty"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] string EnvironmentCode ); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; // registry rarely read, never worth caching protected override async Task> ExecuteAsync(Parameters req, LoginDTO login, CancellationToken ct) { var result = await _BLL.GetPromotionCounterparty(req.EnvironmentCode, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, login); } } }