Admin Export Service
Component Detail
Service Layer
high complexity
backend
3
Dependencies
3
Dependents
3
Entities
0
Integrations
Description
Server-side service that orchestrates the full Bufdir export pipeline. Receives the export job request, queries activities, peer mentor participations, organizational metadata, and related tables for the specified period, transforms the data into Bufdir's required schema, writes the output file to object storage, and records the job in export_logs. Designed to serve both the Admin Web Portal and the mobile one-click export button from the same API contract.
admin-export-service
Responsibilities
- Authenticate and authorize the request (org admin or global admin only)
- Aggregate activities, user roles, and org metadata for the reporting period
- Transform aggregated data into Bufdir-compliant schema (CSV/Excel + JSON submission path)
- Upload generated file to Vercel Blob or S3 and produce a 24 h signed URL
- Record export job status and metadata in export_logs table throughout the pipeline
Interfaces
triggerExport(orgId: string, period: DateRange, userId: string): Promise<ExportJobId>
getExportStatus(jobId: string): Promise<ExportJobStatus>
getExportHistory(orgId: string, pagination: Pagination): Promise<ExportRecord[]>
getSignedDownloadUrl(exportId: string): Promise<string>
Relationships
Dependencies (3)
Components this component depends on
Dependents (3)
Components that depend on this component
Related Data Entities (3)
Data entities managed by this component