Export Service
Component Detail
Service Layer
medium complexity
Shared Component
backend
1
Dependencies
1
Dependents
4
Entities
0
Integrations
Description
Backend service that packages a finalized Bufdir report into the government-accepted file format (Excel, CSV, or structured PDF, to be confirmed with Bufdir). Generates the file asynchronously for large datasets and returns a signed download URL or binary stream scoped to the authenticated user's organization.
export-service
Responsibilities
- Fetch the finalized report data from the Bufdir Reports Repository for the requesting organization
- Serialize report data into the required submission format (xlsx via exceljs, CSV, or PDF)
- Enforce organization-level scoping so users can only export their own organization's reports
- Return a signed download URL or binary stream to the client
- Handle asynchronous generation with status polling for large report datasets
Interfaces
POST /api/v1/bufdir-reports/:reportId/export
GET /api/v1/bufdir-reports/:reportId/export/status
generateExcelFile(reportData: ReportData): Buffer
generateCsvFile(reportData: ReportData): string
scopeToOrganization(userId: string, reportId: string): boolean
Relationships
Related Data Entities (4)
Data entities managed by this component