feat: add ShowBranding flag propagation from API to report data

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-20 12:06:30 +01:00
parent 85ee66750a
commit eec67a90f0
4 changed files with 20 additions and 13 deletions

View File

@@ -38,10 +38,11 @@ public class ReportOrchestrator : IReportOrchestrator
_logger = logger;
}
public async Task<byte[]> GenerateReportAsync(string isin)
public async Task<byte[]> GenerateReportAsync(string isin, bool showBranding = false)
{
// ── Cache check ──────────────────────────────────────────────────
var cached = _cache.Get(isin);
// ── Cache check (chiave include branding) ─────────────────────────
var cacheKey = showBranding ? $"{isin}:branded" : isin;
var cached = _cache.Get(cacheKey);
if (cached != null)
{
_logger.LogInformation("Report per ISIN {Isin} servito da cache ({Size} bytes)", isin, cached.Length);
@@ -56,6 +57,7 @@ public class ReportOrchestrator : IReportOrchestrator
Info = await _dataService.GetCertificateInfoAsync(isin),
Eventi = await _dataService.GetCertificateEventsAsync(isin),
Scenario = await _dataService.GetScenarioAnalysisAsync(isin),
ShowBranding = showBranding,
};
// Determina se lo scenario ha dati validi (evita doppia chiamata SP)
@@ -106,7 +108,7 @@ public class ReportOrchestrator : IReportOrchestrator
isin, finalPdf.Length, pdfSections.Count);
// Salva in cache
_cache.Set(isin, finalPdf);
_cache.Set(cacheKey, finalPdf);
// Cleanup
foreach (var doc in pdfSections)