From 02ca8bc9fb2aa9a3808827ad3ea0bd41a80700ae Mon Sep 17 00:00:00 2001 From: SmartRootsSrl Date: Mon, 23 Mar 2026 15:53:53 +0100 Subject: [PATCH] feat: add ?dividend query param to all report endpoints Co-Authored-By: Claude Sonnet 4.6 --- .../Controllers/ReportController.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CertReports.Syncfusion/Controllers/ReportController.cs b/CertReports.Syncfusion/Controllers/ReportController.cs index cda6f9a..1633b11 100644 --- a/CertReports.Syncfusion/Controllers/ReportController.cs +++ b/CertReports.Syncfusion/Controllers/ReportController.cs @@ -43,7 +43,8 @@ public class ReportController : ControllerBase public async Task GenerateReport( [FromQuery(Name = "p")] string? encryptedIsin = null, [FromQuery(Name = "alias")] string? aliasId = null, - [FromQuery(Name = "branding")] bool showBranding = false) + [FromQuery(Name = "branding")] bool showBranding = false, + [FromQuery(Name = "dividend")] bool showDividend = false) { string? isin = null; @@ -70,7 +71,7 @@ public class ReportController : ControllerBase return BadRequest("Specificare il parametro 'p' (ISIN cifrato) o 'alias' (alias ID)."); } - return await GenerateAndReturnPdf(isin, showBranding); + return await GenerateAndReturnPdf(isin, showBranding, showDividend); } /// @@ -80,14 +81,15 @@ public class ReportController : ControllerBase [HttpGet("by-isin/{isin}")] public async Task GenerateReportByIsin( string isin, - [FromQuery(Name = "branding")] bool showBranding = false) + [FromQuery(Name = "branding")] bool showBranding = false, + [FromQuery(Name = "dividend")] bool showDividend = false) { if (string.IsNullOrWhiteSpace(isin) || isin.Length < 12) { return BadRequest("ISIN non valido."); } - return await GenerateAndReturnPdf(isin, showBranding); + return await GenerateAndReturnPdf(isin, showBranding, showDividend); } /// @@ -97,7 +99,8 @@ public class ReportController : ControllerBase public async Task DownloadReport( [FromQuery(Name = "p")] string? encryptedIsin = null, [FromQuery(Name = "alias")] string? aliasId = null, - [FromQuery(Name = "branding")] bool showBranding = false) + [FromQuery(Name = "branding")] bool showBranding = false, + [FromQuery(Name = "dividend")] bool showDividend = false) { string? isin = null; @@ -111,7 +114,7 @@ public class ReportController : ControllerBase try { - var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding); + var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding, showDividend); return File(pdfBytes, "application/pdf", $"{isin}.pdf"); } catch (Exception ex) @@ -123,12 +126,12 @@ public class ReportController : ControllerBase // ─── Helper ──────────────────────────────────────────────────────── - private async Task GenerateAndReturnPdf(string isin, bool showBranding) + private async Task GenerateAndReturnPdf(string isin, bool showBranding = false, bool showDividend = false) { try { _logger.LogInformation("Richiesta report per ISIN {Isin}", isin); - var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding); + var pdfBytes = await _orchestrator.GenerateReportAsync(isin, showBranding, showDividend); // Inline: il PDF si apre direttamente nel browser Response.Headers.Append("Content-Disposition", $"inline; filename={isin}.pdf");