Report Export Service
Component Detail
Service Layer
medium complexity
backend
1
Dependencies
1
Dependents
1
Entities
0
Integrations
Description
Server-side Next.js service that generates CSV or PDF exports of team reports based on query parameters, keeping mobile payload small. Enforces the same role-scoped association filter as the main report endpoint and returns a file download response.
report-export-service
Responsibilities
- Generate CSV export of team report data with per-mentor rows
- Generate PDF export with formatted tables and organization branding
- Validate that the requesting coordinator has access to the requested association
- Apply all active filters (date range, activity type, peer mentor) to export data
- Stream file response to client to minimize memory usage
Interfaces
exportCsv(associationId, filters, res)
exportPdf(associationId, filters, res)
validateExportAccess(userId, associationId)
buildExportQuery(filters)
streamFileResponse(buffer, filename, contentType, res)