using FastEndpoints; using FrameworkBLL.CommonReport; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.CommonReport { public class GetPivotConfig : BaseEndpoint> { private readonly ICommonReportBLL _bll; public GetPivotConfig(ICommonReportBLL bll) => _bll = bll; public override void Configure() { Get("/CommonReport/GetPivotConfig"); AllowAnonymous(); } public record GetPivotConfigParameters( [property: FromHeader] string Login, [property: QueryParam] int ReportViewId ); protected override string? GetCacheKey(GetPivotConfigParameters req, LoginDTO login) => KeyGenerator.KeyGeneration(req.ReportViewId, EntityConstant.OBJECTREPORTVIEW, CacheKeyLevel.CLIENT_LEVEL, login); protected override async Task> ExecuteAsync( GetPivotConfigParameters req, LoginDTO loginDTO, CancellationToken ct) { var result = await _bll.GetPivotFieldConfig(req.ReportViewId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } } }