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

Description

Backend service that translates user-selected dimensions, metrics, and filters into parameterized PostgreSQL queries. Enforces strict input validation to prevent injection, paginates results, and provides the same CSV data pipeline used by Team Reports.

Feature: Custom Reports

custom-report-service

Responsibilities

  • Validate and whitelist incoming dimension and metric identifiers before query construction
  • Build and execute parameterized SQL queries against the PostgreSQL database
  • Return paginated result sets with total count for frontend rendering
  • Serialize query results to CSV format for download
  • Persist and retrieve saved report template configurations as JSON

Interfaces

executeReport(params: ReportQueryParams): Promise<PaginatedReportResult>
exportCsv(params: ReportQueryParams): Promise<Buffer>
saveTemplate(orgId: string, name: string, params: ReportQueryParams): Promise<ReportTemplate>
listTemplates(orgId: string): Promise<ReportTemplate[]>
getTemplate(templateId: string): Promise<ReportTemplate>
deleteTemplate(templateId: string): Promise<void>
getAvailableDimensions(): Dimension[]
getAvailableMetrics(): Metric[]

Related Data Entities (1)

Data entities managed by this component