Contacts Service
Component Detail
Service Layer
medium complexity
Shared Component
mobile
1
Dependencies
1
Dependents
1
Entities
0
Integrations
Description
Riverpod provider exposing a reactive combined state of the full contact list and the current search query, with the filtered view derived reactively from the underlying Drift stream. Applies role-based scoping at the provider level so peer mentors see only their assigned contacts while coordinators see all contacts across their local chapter.
contacts-service
Responsibilities
- Subscribe to the Drift contacts stream and rebuild derived state on any local data change
- Apply role-based scoping so peer mentors see own contacts and coordinators see chapter-wide contacts
- Derive a filtered contact list from the full list and search query using case-insensitive substring matching on name fields
- Trigger a backend sync via Sync Queue Service when connectivity is available
- Expose offset-based or cursor-based paging support for large coordinator contact sets
Interfaces
watchContacts(userId: String, role: UserRole) → Stream<List<Contact>>
searchContacts(query: String, contacts: List<Contact>) → List<Contact>
refreshContacts() → Future<void>
getContactById(contactId: String) → Future<Contact?>
getPagedContacts(chapterId: String, offset: int, limit: int) → Future<List<Contact>>