Expense CSV Export Service
Component Detail
Service Layer
medium complexity
Shared Component
backend
1
Dependencies
1
Dependents
2
Entities
0
Integrations
Description
Streaming export service that writes filtered expense records directly to the HTTP response without buffering the full result set in memory. Accepts the same filter parameters as the drill-down query and produces a structured CSV suitable for accounting system reconciliation.
expense-csv-export-service
Responsibilities
- Stream SQL query results as CSV rows directly to the HTTP response using Node.js streaming
- Apply the same filter parameters (submitter, expense type, date range) as the drill-down query
- Format output columns including claim ID, submitter name, expense type, amount, status, submitted date, and approved date
- Set Content-Type and Content-Disposition headers to trigger a browser file download
Interfaces
streamExport(orgId: string, filters: ExpenseFilters, res: Response): Promise<void>
buildCsvHeaders(): string[]
formatRow(record: ExpenseRecord): string
Relationships
Related Data Entities (2)
Data entities managed by this component