Team Stats Service
Component Detail
Service Layer
medium complexity
backendmobile
0
Dependencies
1
Dependents
8
Entities
0
Integrations
Description
Backend-driven service that queries activity data scoped to all peer mentors within the coordinator's local association, applying row-level security. Performs server-side aggregation via the Next.js REST API to keep the mobile client lightweight, supporting filtering by date range, activity type, and individual mentor with pagination for large associations.
team-stats-service
Responsibilities
- Fetch aggregated team statistics from the REST API with association scoping
- Apply date range, activity type, and mentor filters to queries
- Calculate trend data comparing current and previous periods
- Handle pagination and lazy loading for large mentor lists
- Support multi-association context switching
Interfaces
getTeamStats(associationId: String, filters: ReportFilters): Future<TeamStats>
getMentorBreakdown(associationId: String, filters: ReportFilters, page: int): Future<PaginatedResult<MentorStats>>
getTrendData(associationId: String, period: TrendPeriod): Future<TrendData>
getAssociationsForCoordinator(userId: String): Future<List<Association>>
getMentorDetail(mentorId: String, filters: ReportFilters): Future<MentorDetailStats>
identifyUnderreportingMentors(associationId: String, threshold: int): Future<List<MentorStats>>
getActivityTypeDistribution(associationId: String, filters: ReportFilters): Future<Map<String, int>>
Relationships
Related Data Entities (8)
Data entities managed by this component