using FastEndpoints; using FrameworkBLL.ParameterSet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.ParameterSet { public class GetParameterSet : BaseEndpoint { private readonly IParameterSetBLL _parameterSetBLL; public GetParameterSet(IParameterSetBLL parameterSetBLL) { _parameterSetBLL = parameterSetBLL; } public override void Configure() { Get("/ParameterSet/GetParameterSet"); AllowAnonymous(); } public record GetParameterSetParameters( [property: QueryParam] int ParameterSetId, [property: FromHeader] string Login ); protected override async Task> ExecuteAsync(GetParameterSetParameters parameters, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _parameterSetBLL.GetParameterSet(parameters.ParameterSetId, 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); } } } }