using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PartnerBLL.ClientDomain; using static GB5Shared.GB5Constant.Constant; namespace PartnerSL.EndPoints.ClientDomain { public class GetPlatformCnameTarget : BaseEndpoint> { private readonly IClientDomainBLL _bll; public GetPlatformCnameTarget(IClientDomainBLL bll) => _bll = bll; public override void Configure() { Get("/PlatformCnameTarget/GetPlatformCnameTarget"); AllowAnonymous(); // or restrict to admin, per your auth setup } public record Params([property: FromHeader] string Login); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _bll.GetPlatformCnameTarget(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); } } } }