ProfileRepository
Component Detail
Description
The data access layer responsible for persisting and retrieving profile records both locally (SQLite/AsyncStorage cache) and remotely via the backend API. Abstracts storage details from the service layer and provides a consistent interface regardless of connectivity state. Handles cache invalidation and conflict resolution when syncing with the server.
profile-repository
Sources & reasoning
Profile Data & Settings is MVP per the blueprint [MVP] marker. The source doc lists peer mentor profile screens and settings as explicit Mobile App screen inventory items (lines 294, 297), and the Fase 1 MVP scope requires two mobile role profiles (line 325). The org labels system (line 310) means the profile UI must dynamically reflect per-org terminology, making this a foundational integration surface from launch.
-
docs/source/likeperson.md Ā· line 294-297Contact detail, edit, and peer mentor profile screens - Activity wizard (multi-step: contact ā date ā time ā duration ā summary) - Event wizard - Settings and preferences
-
docs/source/likeperson.md Ā· line 310Organization labels system - per-org terminology overrides fetched from backend and cached offline (currently: `contacts`, `my_contacts`, `peer_mentors`; extensible to singular forms
-
docs/source/likeperson.md · line 3252 mobilrolle-profiler: Peer Mentor, Coordinator (Organization Admins logger pÄ som Coordinator i app-konteksten)
Responsibilities
- Persist profile data to local device cache for offline access
- Retrieve cached profile records and return stale data when offline
- Sync local changes to the backend and handle conflict resolution
- Invalidate and refresh cache entries after a successful remote update
- Map raw API response payloads to typed UserProfile domain objects
Interfaces
findById(userId: string): Promise<UserProfile | null>
save(profile: UserProfile): Promise<void>
syncToRemote(userId: string): Promise<SyncResult>
invalidateCache(userId: string): void