Add Protection Report Generator with HTML/PDF output and scheduled delivery (FRE-4575)

- Report service: data collection from all three engines, HTML rendering (Handlebars), PDF generation (pdfkit)
- REST API: /reports endpoints for generate, history, view, PDF download, scheduling
- BullMQ workers: queued report generation with retry, monthly/annual scheduler triggers
- DB: SecurityReport model with Prisma schema and type exports
- Email: report_ready template in shared-notifications
- All dependencies wired through existing packages

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-09 22:54:46 -04:00
parent de0ddac65d
commit 2521c4e998
17 changed files with 1712 additions and 1 deletions

View File

@@ -94,6 +94,31 @@ export const DefaultEmailTemplates: TemplateDefinition[] = [
{ name: 'report_url', type: 'string', required: true },
],
},
{
id: 'report_ready',
name: 'Report Ready Notification',
channel: 'email',
locale: 'en',
category: 'report',
subject: 'ShieldAI: {{report_title}} Ready',
body: 'Hi {{name}},\n\nYour {{report_title}} is ready to view.\n\nSummary: {{report_summary}}\n\nView Report: {{report_url}}\nDownload PDF: {{pdf_url}}\n\nBest regards,\nThe ShieldAI Team',
htmlBody: `
<h2>Your ShieldAI Report is Ready</h2>
<p>Hi {{name}},</p>
<p><strong>{{report_title}}</strong></p>
<p>{{report_summary}}</p>
<p><a href="{{report_url}}">View Report</a></p>
<p><a href="{{pdf_url}}">Download PDF</a></p>
<p>Best regards,<br>The ShieldAI Team</p>
`,
variables: [
{ name: 'name', type: 'string', required: true },
{ name: 'report_title', type: 'string', required: true },
{ name: 'report_summary', type: 'string', required: false, defaultValue: 'Your protection report contains detailed statistics and recommendations.' },
{ name: 'report_url', type: 'string', required: true },
{ name: 'pdf_url', type: 'string', required: true },
],
},
];
export const DefaultSMSTemplates: TemplateDefinition[] = [