Data Layer medium complexity Shared Component mobile
1
Dependencies
0
Dependents
5
Entities
0
Integrations

Description

Provides read and write access to the local SQLite mirror of server-side data required for offline operation — specifically activities, contacts, peer_mentors, activity_types, and settings. Built on drift with type-safe DAOs. Acts as the single source of truth for all data reads in the app, with the sync service responsible for keeping it fresh.

Feature: Offline Support & Data Sync

local-cache-repository

Responsibilities

  • Provide type-safe CRUD access to locally mirrored entity tables via drift DAOs
  • Return locally cached data immediately without network round-trips
  • Persist incoming server data received during sync to local tables
  • Expose reactive watch streams for live UI updates on data changes

Interfaces

getActivities(userId: String): Future<List<Activity>>
watchActivities(userId: String): Stream<List<Activity>>
upsertActivity(activity: Activity): Future<void>
getContacts(userId: String): Future<List<Contact>>
watchContacts(userId: String): Stream<List<Contact>>
upsertContact(contact: Contact): Future<void>
getPeerMentors(associationId: String): Future<List<PeerMentor>>
upsertPeerMentor(mentor: PeerMentor): Future<void>
getActivityTypes(): Future<List<ActivityType>>
upsertActivityTypes(types: List<ActivityType>): Future<void>
getUserSettings(userId: String): Future<Settings?>
upsertSettings(settings: Settings): Future<void>
clearUserData(userId: String): Future<void>

Relationships

Dependencies (1)

Components this component depends on