Service Layer medium complexity mobile
0
Dependencies
1
Dependents
15
Entities
0
Integrations

Description

Orchestrates data fetching and aggregation for the role-specific home dashboard. Subscribes to appropriate BLoC streams (ActivityBloc, AssignmentBloc, TeamStatsBloc) depending on the authenticated user's role, applies stale-while-revalidate caching strategy, and assembles the dashboard view model with role-appropriate sections.

Feature: Role-Specific Home Dashboard

dashboard-service

Responsibilities

  • Detect authenticated user role and select appropriate data streams
  • Aggregate dashboard data from multiple BLoC sources into a unified view model
  • Implement stale-while-revalidate strategy using local SQLite cache and REST API
  • Provide Peer Mentor dashboard data (recent activities, follow-ups, personal stats)
  • Provide Coordinator dashboard data (team overview, pending approvals, assignment dispatches)

Interfaces

getDashboardData(UserRole): Stream<DashboardViewModel>
getPeerMentorDashboard(): Stream<PeerMentorDashboardData>
getCoordinatorDashboard(): Stream<CoordinatorDashboardData>
getRecentActivities(int limit): Future<List<Activity>>
getUpcomingFollowUps(): Future<List<Contact>>
getPersonalStats(): Future<PersonalStats>
getTeamOverview(): Future<TeamStats>
getPendingApprovals(): Future<List<Approval>>
getAssignmentDispatches(): Future<List<Assignment>>
refreshDashboard(): Future<void>
getCachedDashboard(UserRole): DashboardViewModel?

Relationships

Dependents (1)

Components that depend on this component