Export Generation Service
Component Detail
Service Layer
medium complexity
backend
3
Dependencies
4
Dependents
2
Entities
0
Integrations
Description
Core backend service that receives a validated Bufdir report payload and transforms it into the requested file format (PDF, CSV, or XML). Handles server-side PDF rendering via PDFKit, structured data serialization, rate limiting to prevent duplicate submissions, and delegates file delivery to the mobile file system or admin portal download endpoint.
export-generation-service
Responsibilities
- Accept export requests with report ID and target format, validate report is in submitted state
- Render PDF exports server-side using PDFKit with versioned Bufdir-compliant templates
- Serialize CSV and XML exports from the normalized report payload
- Apply per-organization rate limiting to prevent accidental duplicate submissions
- Write an export log record on every successful or failed export attempt
Interfaces
generateExport(reportId: string, format: ExportFormat, requestedBy: UserId): Promise<ExportResult>
generatePDF(payload: BufdirReportPayload): Promise<Buffer>
generateCSV(payload: BufdirReportPayload): string
generateXML(payload: BufdirReportPayload): string
checkRateLimit(orgId: string): boolean
getExportDownloadUrl(exportId: string): string
listExportLogs(reportId: string, options: PaginationOptions): ExportLogEntry[]
Relationships
Dependencies (3)
Components this component depends on
Dependents (4)
Components that depend on this component
Related Data Entities (2)
Data entities managed by this component