Skip to content

feat(reports): add pdf report export#200

Open
Nekolandd wants to merge 1 commit into
MD-Creative-Production:mainfrom
Nekolandd:feat/129-pdf-report-export
Open

feat(reports): add pdf report export#200
Nekolandd wants to merge 1 commit into
MD-Creative-Production:mainfrom
Nekolandd:feat/129-pdf-report-export

Conversation

@Nekolandd

Copy link
Copy Markdown

Description

Adds PDF export for security findings reports at src/modules/reports/pdf/, allowing stakeholders to download executive security summaries as PDF files.

Implements a new ReportsModule with a download endpoint that reuses existing ReportingService data and renders it through a dedicated PDF template using pdfkit.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Related Issues

Fixes #129

Changes Made

  • PDF generationsrc/modules/reports/pdf/pdf-report.service.ts using pdfkit
  • Report templatesrc/modules/reports/pdf/pdf-report.template.ts (executive summary, severity breakdown, top affected chains)
  • Download endpointGET /api/reports/security/pdf (optional ?days=7) returns downloadable PDF via StreamableFile
  • Module wiringsrc/modules/reports/reports.module.ts registered in apps/backend/src/app.module.ts
  • Build configapps/backend/tsconfig.app.json includes src/modules/reports for backend compilation
  • Dependency — added pdfkit + @types/pdfkit
  • Tests — 6 unit tests (service, template, controller)

Testing

  • I have tested these changes locally
  • Tests pass locally — 6/6 (npm run test:backend -- --testPathPatterns=reports)
  • Linting passes on reports files (eslint + prettier --write)
  • Code is formatted (prettier --write on reports files)
  • TypeScript builds successfully (npm run build)

How to verify:

  • npm run prisma:generate
  • npm run build
  • npm run test:backend -- --testPathPatterns=reports

Manual download test (with backend running):

  • curl -o report.pdf "http://localhost:3000/api/reports/security/pdf?days=7"

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests passed with my changes

Additional Context

  • Implementation scope: follows issue path src/modules/reports/pdf/ as specified in Add PDF Report Export #129.
  • Data source: reuses ReportingService.getSecurityReport() from the existing reporting module in apps/backend/src/modules/reporting/.
  • Cross-module imports: src/modules/reports imports reporting types/services from apps/backend/; tsconfig.app.json was updated to compile the new module.
  • New dependency: pdfkit is used for server-side PDF generation.
  • Acceptance criteria met:
    • PDF export working
    • Templates implemented
    • Reports downloadable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PDF Report Export

1 participant