using System.Collections.Generic; 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; namespace AnalyticsSL.EndPoints.BI { /// Dedicated, disposable pilot target for the ApiService DatasetKind round-trip — /// see the plan's "Pilot — prove the round-trip before touching a real report" section. /// Returns a handful of hardcoded rows so the whole chain (MDATASOURCE → MBICATALOG /// → MBIFIELDMAPPING → IExcelExport.ReportURICalling → GroupInMemory) can be proven /// against something simple before pointing ApiResourcePath at a real report. Delete once /// a real report replaces it, same as the Warehouse engine's FSALE_TEST/FFINANCE_TEST /// catalog entries were meant to be disposable proof, not permanent fixtures. /// /// AVGDEALSIZE is deliberately NonAdditive — the pilot's field-mapping row for it must /// classify it that way, and the verification step (plan step 4) confirms /// AnalysisAggregationService.ValidateAdditivity rejects a SUM request against it using the /// server-side MBIFIELDMAPPING classification, not whatever the caller supplied. public class PilotApiServiceTest : BaseEndpoint> { public override void Configure() { Post("/BI/PilotApiServiceTest"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO? CriteriaDTO ); protected override string? GetCacheKey(Params req, LoginDTO login) => null; protected override async Task> ExecuteAsync(Params req, LoginDTO login, CancellationToken ct) { var rows = new List> { new() { ["REGION"] = "North", ["REVENUE"] = 1000, ["AVGDEALSIZE"] = 250 }, new() { ["REGION"] = "South", ["REVENUE"] = 2000, ["AVGDEALSIZE"] = 400 }, new() { ["REGION"] = "East", ["REVENUE"] = 1500, ["AVGDEALSIZE"] = 300 }, }; return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(rows, CacheKeyLevel.NOT_REQUIRED, login); } } }