using AccountsBLL.AccountReports.AccountTrialBalance; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.AccountReports { // Field/column config for the Periodic Pivot (see AccountTrialBalancePeriodicPivotReport) — lets // the FE build its grouping/column definitions from the real MREPORTVIEWFIELDS config seeded by // DB/Migrations/20260829_AccountTrialBalance_PeriodicPivot_ReportView_Seed_SqlServer.sql instead // of hardcoding GROUP_FIELDS/LEAF_FIELDS. A same-host equivalent of the generic // Framework.CommonReport.GetPivotConfig endpoint, which isn't reachable here — HRFinanceHost // (this report's host) has no ProjectReference to FrameworkSL. public class GetAccountTrialBalancePeriodicPivotConfig : BaseEndpoint> { private readonly IAccountTrialBalanceReportBLL _bll; public GetAccountTrialBalancePeriodicPivotConfig(IAccountTrialBalanceReportBLL bll) { _bll = bll; } public override void Configure() { Get("/AccountReports/GetAccountTrialBalancePeriodicPivotConfig"); AllowAnonymous(); } public record GetAccountTrialBalancePeriodicPivotConfigParameter( [property: FromHeader] string Login ); protected override string? GetCacheKey(GetAccountTrialBalancePeriodicPivotConfigParameter req, LoginDTO login) => $"AccountTrialBalancePeriodicPivotConfig:{login.ClientId}"; protected override async Task> ExecuteAsync( GetAccountTrialBalancePeriodicPivotConfigParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetTrialBalancePeriodicPivotFieldConfig(login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.CLIENT_LEVEL, login).ConfigureAwait(false); } } }