Report Store
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
2
Dependents
8
Entities
0
Integrations
Description
Data access layer for team report queries against the PostgreSQL database. Provides optimized read queries with indexes on organization_id, created_at, and user_id for performance. Handles the translation of filter parameters into efficient SQL queries and manages cached aggregation results for frequently requested report configurations.
report-store
Responsibilities
- Execute optimized aggregation queries against PostgreSQL
- Translate filter parameters into indexed SQL WHERE clauses
- Cache frequently requested report aggregations
- Provide efficient pagination for large result sets
Interfaces
queryActivitiesByOrg(orgId: string, filters: QueryFilters): Activity[]
getAggregatedStats(orgId: string, groupBy: string[], dateRange: DateRange): AggregatedRow[]
getActivityCountByType(orgId: string, dateRange: DateRange): TypeCount[]
getHoursByPeerMentor(orgId: string, dateRange: DateRange): MentorHours[]
getContactsReachedCount(orgId: string, dateRange: DateRange): number
getCachedReport(cacheKey: string): CachedReport | null
setCachedReport(cacheKey: string, data: CachedReport, ttl: number): void
Relationships
Dependents (2)
Components that depend on this component
Related Data Entities (8)
Data entities managed by this component