Service Layer medium complexity mobilebackend
1
Dependencies
1
Dependents
9
Entities
0
Integrations

Description

Riverpod provider that fetches coordinator-scoped team statistics from the REST API, caching results in Drift for offline access. Joins activities with user_organization_roles to scope the aggregation to the calling coordinator's local association, and reuses the aggregation computation logic from the personal statistics service with a team-level scope parameter.

Feature: Coordinator Team Reports

team-stats-service

Sources & reasoning

The service encapsulates the team-scoped aggregation logic, role enforcement, and offline caching. Coordinators only log into the mobile app, making this service critical for providing the reporting capability that currently requires unsustainable manual spreadsheet workflows.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Request team-scoped activity aggregates from REST API with coordinator auth token
  • Scope query to coordinator's organization and local association via RBAC context
  • Cache paginated results in Drift for offline read access
  • Expose sorted and filtered view models to Team Report Screen
  • Propagate coordinator role enforcement to API call headers

Interfaces

fetchTeamStats(DateRange, SortField) → Future<TeamStatsResult>
getTeamStatsStream(DateRange) → Stream<List<MentorStatRow>>
invalidateCache() → Future<void>
getMentorDetail(String mentorId, DateRange) → Future<MentorStatDetail>

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component