Data Layer medium complexity mobile
0
Dependencies
0
Dependents
5
Entities
0
Integrations

Description

Data access layer providing read operations for contacts and peer mentors from Supabase with local caching via Riverpod. Handles offline scenarios by serving stale cache with periodic background refresh. Supabase RLS policies enforce organisation-scoped data access at the database level.

Feature: Contact List & Search

contact-repository

Responsibilities

  • Fetch contacts and peer mentors from Supabase with RLS-enforced organisation scoping
  • Maintain local cache with configurable TTL for low-connectivity support
  • Provide filtered and sorted data streams to the service layer

Interfaces

getContacts(orgId: String) Future<List<Contact>>
getPeerMentors(orgId: String) Future<List<PeerMentor>>
searchContacts(query: String, orgId: String) Future<List<Contact>>
searchPeerMentors(query: String, orgId: String) Future<List<PeerMentor>>
getContactById(id: String) Future<Contact?>
getCachedContacts() List<Contact>
refreshCache()
watchContacts() Stream<List<Contact>>