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

Description

Data-access component responsible for reading note records from local storage and the remote backend. It implements the offline-first strategy defined by the offline-data-support dependency, returning cached data immediately while background-syncing with the server. All queries are keyed by user ID to ensure correct data isolation.

Feature: Notes List

notes-repository

Sources & reasoning

The priority matrix explicitly lists Notes as needed by all five organizations (all checkmarks), classified NICE, Phase 2. Phase 2 maps to v1.0 by the ordinal rule. The Notes List is the entry screen without which the Note Editor is unreachable, making it a prerequisite for the entire area.

Responsibilities

  • Read notes from the local SQLite or AsyncStorage cache for instant offline display
  • Synchronise with the remote API and merge incoming records into the local cache
  • Provide query methods scoped strictly to a given userId
  • Persist sync metadata (last-fetched timestamp, conflict flags) alongside note records
  • Expose a clean Note entity type and map raw API or DB rows to it

Interfaces

findByUser(userId: string): Promise<Note[]>
findByUserAndQuery(userId: string, query: string): Promise<Note[]>
syncFromRemote(userId: string): Promise<void>
getCachedAt(userId: string): Date | null