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

Description

Backend service implementing the /api/v1/reports/team endpoint. Aggregates activity data from the activities and organization_memberships tables with role-based tenant isolation: coordinators see their local chapter only, org admins see their full organization, global admins are blocked from operational data by default. Computes data on-demand without materialized caches.

Feature: Team Reports

report-generation-service

Responsibilities

  • Apply role-based tenant scoping before any query execution (coordinator = local chapter, org admin = full org, global admin = blocked)
  • Aggregate total hours, activity count, contact coverage, and last activity per peer mentor for the requested filters
  • Support chunked/paginated result fetch for large organizations
  • Validate and sanitize date range, activity type, and org unit query parameters
  • Return structured ReportRow and ReportSummary payloads in a single response

Interfaces

GET /api/v1/reports/team
generateTeamReport(filters: ReportFilters, userContext: AuthContext): Promise<TeamReportResult>
TeamReportResult: { rows: ReportRow[], summary: ReportSummaryStats, totalCount: number }
applyTenantScope(query: QueryBuilder, userContext: AuthContext): QueryBuilder

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component