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

Description

Backend service responsible for aggregating activity data into team-level reports. Executes PostgreSQL queries with window functions and GROUP BY clauses grouped by organization tenant, local association, date bucket, and activity type. Accepts filter parameters via the REST API endpoint and returns pre-aggregated JSON with pagination support. Enforces role-based data scoping so coordinators see only their association while org admins see full organization scope.

Feature: Team Reports

report-generation-service

Responsibilities

  • Aggregate activity data using PostgreSQL window functions and GROUP BY
  • Apply multi-dimensional filters (date range, association, activity type, peer mentor)
  • Enforce tenant-scoped and role-based data access
  • Return pre-aggregated JSON with pagination for large datasets
  • Compute trend calculations over selectable time periods

Interfaces

generateTeamReport(orgId: string, filters: ReportFilters): TeamReport
getTeamStats(orgId: string, dateRange: DateRange): TeamStats
getActivityBreakdown(orgId: string, groupBy: GroupByField): ActivityBreakdown[]
getTrendData(orgId: string, period: TimePeriod): TrendData[]
getPeerMentorPerformance(orgId: string, filters: ReportFilters): MentorMetrics[]
getAssociationComparison(orgId: string, dateRange: DateRange): AssociationStats[]
validateReportAccess(userId: string, orgId: string): boolean
paginateResults(data: any[], page: number, pageSize: number): PaginatedResult

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component