Service Layer high complexity backend
1
Dependencies
1
Dependents
8
Entities
0
Integrations

Description

Server-side service that aggregates all relevant activity data for a given reporting period and formats it according to Bufdir's specification. Streams the generated file (PDF or structured Excel/CSV) as a downloadable artifact and persists export metadata for audit trails.

Feature: Bufdir Export

bufdir-export-service

Responsibilities

  • Query activities, users, organizations, and reporting_periods tables filtered by period
  • Format aggregated data according to Bufdir's required schema
  • Generate and stream the export artifact as a downloadable file
  • Record export metadata in bufdir_reports for idempotent re-runs and audit trails
  • Validate that the requesting user has org-admin access to the target organization

Interfaces

generateExport(organizationId: string, periodId: string): Promise<ExportStream>
getExportHistory(organizationId: string): Promise<ExportRecord[]>
validatePeriodEligibility(periodId: string): Promise<boolean>
buildBufdirPayload(periodId: string): Promise<BufdirPayload>

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component