using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; using FrameworkBLL.ParameterSet; namespace FrameworkSL.Endpoints.ParameterSet { // Modern replacement for the legacy GB4 /cs/Criteria.svc/List?ObjectCode=PARAMETERSETDETAIL // endpoint. Accepts the same SectionCriteriaList/AttributesCriteriaList shape // (e.g. FieldName "Parameter.Id" with an In list, "ParameterSet.Id" with Equal). public class GetParameterSetDetailList : BaseEndpoint> { private readonly IParameterSetBLL _parameterSetBLL; public GetParameterSetDetailList(IParameterSetBLL parameterSetBLL) { _parameterSetBLL = parameterSetBLL; } public override void Configure() { Post("/ParameterSet/GetParameterSetDetailList"); AllowAnonymous(); } public record GetParameterSetDetailListParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetParameterSetDetailListParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _parameterSetBLL.GetParameterSetDetailList(req.CriteriaDTO, 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); } } } }