Dashboard Service
Component Detail
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.
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
Related Data Entities (15)
Data entities managed by this component
Activity
26 fields
core
Activity Approval
19 fields
core
Assignment
21 fields
core
Expense
23 fields
core
Feature Flag
8 fields
configuration
Notification
21 fields
core
User
21 fields
core
User Role
11 fields
configuration
Achievements
17 fields
core
Activities
24 fields
core
Assignments
27 fields
core
Contacts
24 fields
core
Notifications
24 fields
core
User Roles
13 fields
core
Users
26 fields
core