Service Layer medium complexity backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Backend service that streams query results server-side as a CSV file download in response to an export request from the Reports Page. Applies the same tenant-scoped filter logic as the Report Generation Service to guarantee the exported data matches what the coordinator sees on screen. Streams rows incrementally to avoid buffering large result sets in memory.

Feature: Team Reports

report-csv-export-service

Sources & reasoning

A secondary CSV export endpoint is explicitly called out in the implementation notes as streaming server-side. This is a distinct service responsibility from report display - it handles chunked I/O and Content-Disposition headers - and must reuse the same tenant-scoping predicates to ensure export fidelity matches on-screen data.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Stream tenant-scoped query results as CSV with correct MIME headers
  • Apply identical filter predicates used by the Report Generation Service
  • Include human-readable column headers using organization terminology overrides
  • Log export events to the reports table for audit traceability

Interfaces

streamCsvExport(orgId: string, filters: ReportFilters, res: ServerResponse): void
buildCsvRow(activity: ActivityRow, labels: TerminologyMap): string

Related Data Entities (1)

Data entities managed by this component