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

@@ -42,7 +42,8 @@ public class ReportController : ControllerBase
[HttpGet]
public async Task<IActionResult> GenerateReport(
[FromQuery(Name = "p")] string? encryptedIsin = null,
[FromQuery(Name = "alias")] string? aliasId = null)
[FromQuery(Name = "alias")] string? aliasId = null,
[FromQuery(Name = "branding")] bool showBranding = false)
{
string? isin = null;
@@ -69,7 +70,7 @@ public class ReportController : ControllerBase
return BadRequest("Specificare il parametro 'p' (ISIN cifrato) o 'alias' (alias ID).");
}
return await GenerateAndReturnPdf(isin);
return await GenerateAndReturnPdf(isin, showBranding);
}
/// <summary>
@@ -77,14 +78,16 @@ public class ReportController : ControllerBase
/// In produzione proteggere con autenticazione.
/// </summary>
[HttpGet("by-isin/{isin}")]
public async Task<IActionResult> GenerateReportByIsin(string isin)
public async Task<IActionResult> GenerateReportByIsin(
string isin,
[FromQuery(Name = "branding")] bool showBranding = false)
{
if (string.IsNullOrWhiteSpace(isin) || isin.Length < 12)
{
return BadRequest("ISIN non valido.");
}
return await GenerateAndReturnPdf(isin);
return await GenerateAndReturnPdf(isin, showBranding);
}
/// <summary>
@@ -93,7 +96,8 @@ public class ReportController : ControllerBase
[HttpGet("download")]
public async Task<IActionResult> DownloadReport(
[FromQuery(Name = "p")] string? encryptedIsin = null,
[FromQuery(Name = "alias")] string? aliasId = null)
[FromQuery(Name = "alias")] string? aliasId = null,
[FromQuery(Name = "branding")] bool showBranding = false)
{
string? isin = null;
@@ -107,7 +111,7 @@ public class ReportController : ControllerBase
try
{
var pdfBytes = await _orchestrator.GenerateReportAsync(isin);
var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding);
return File(pdfBytes, "application/pdf", $"{isin}.pdf");
}
catch (Exception ex)
@@ -119,12 +123,12 @@ public class ReportController : ControllerBase
// ─── Helper ────────────────────────────────────────────────────────
private async Task<IActionResult> GenerateAndReturnPdf(string isin)
private async Task<IActionResult> GenerateAndReturnPdf(string isin, bool showBranding)
{
try
{
_logger.LogInformation("Richiesta report per ISIN {Isin}", isin);
var pdfBytes = await _orchestrator.GenerateReportAsync(isin);
var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding);
// Inline: il PDF si apre direttamente nel browser
Response.Headers.Append("Content-Disposition", $"inline; filename={isin}.pdf");