using AccountsBLL.Account; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.Account { public class GetAccountParameter : BaseEndpoint> { private readonly IAccountBLL _AccountBLL; public GetAccountParameter(IAccountBLL AccountBLL) { _AccountBLL = AccountBLL; } public override void Configure() { Get("/Account/GetAccountParameter/"); AllowAnonymous(); } // 🔹 RENAMED to avoid Swagger schema collision public record GetAccountParameterRequest( [property: FromHeader] string Login, [property: QueryParam] int AccountId ); protected override string? GetCacheKey( GetAccountParameterRequest parameters, LoginDTO loginDTO) { return KeyGenerator.KeyGeneration( parameters.AccountId, EntityConstant.OBJECTACCOUNT, CacheKeyLevel.USER_LEVEL, loginDTO ); } protected override async Task> ExecuteAsync( GetAccountParameterRequest req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _AccountBLL.GetAccountParameter(req.AccountId, loginDTO); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse(result, CacheKeyLevel.USER_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError( ex, CacheKeyLevel.USER_LEVEL, loginDTO, ex.Message, 500 ); } } } }