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

Description

Data access layer that abstracts reads and writes between the remote REST API and the local Drift SQLite database. Implements an offline-first strategy by serving cached records immediately while triggering background sync. Exposes query methods supporting name and phone number search directly against the local store.

Feature: Contact List & Search

contact-repository

Sources & reasoning

Priority matrix (line 162) marks contact search MUST in Phase 1 across all four organizations. MVP scope narrative (line 320) lists contact list as Phase 1. Architecture section (line 291) confirms role-specific list views. Phase 1 in source docs maps to MVP by ordinal position (Fase 1 = first deliverable phase = MVP).

Responsibilities

  • Persist and retrieve contact records in the local Drift database
  • Fetch contact data from the remote API and reconcile with local cache
  • Execute name and phone number search queries against local SQLite
  • Track sync timestamps and dirty flags for incremental updates
  • Expose reactive data streams for real-time downstream updates

Interfaces

getContactsByOwner(ownerId: string): Stream<List<Contact>>
getAllContacts(): Stream<List<Contact>>
searchByNameOrPhone(query: string): Future<List<Contact>>
upsertContacts(contacts: List<Contact>): Future<void>
getLastSyncTimestamp(): Future<DateTime?>

Related Data Entities (1)

Data entities managed by this component