reports
Component Detail
Data Layer
low complexity
Shared Component
backend
0
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
PostgreSQL data layer for persisted report template records keyed to the generating user's organization. Stores report name, serialized ReportParams (dimensions, filters, groupings), creation metadata, and last-run timestamp. Shared with the Team Reports feature which also writes summary report metadata to this table.
reports
Sources & reasoning
The reports table already exists in the schema for Team Reports. Custom Reports persists its saved templates to the same table, making this a genuinely shared data component. Tenant scoping via organization_id ensures isolation between organizations.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Persist saved custom report templates with tenant-scoped organization_id
- Retrieve report templates filtered by organization and optional user ownership
- Store last-executed report parameters for template restoration
Interfaces
create(template: ReportTemplate): Promise<ReportTemplate>
findByOrg(orgId: string): Promise<ReportTemplate[]>
findById(id: string, orgId: string): Promise<ReportTemplate | null>
update(id: string, patch: Partial<ReportTemplate>): Promise<ReportTemplate>
delete(id: string, orgId: string): Promise<void>