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

Description

Data access layer that handles all read and write operations for user profile records. Abstracts the underlying storage mechanism (remote API or local cache) and provides a consistent interface to ProfileService. Manages cache invalidation to ensure the UI always reflects the latest persisted state.

Feature: Profile Data & Settings

profile-repository

Sources & reasoning

The source doc explicitly lists profile screens in the mobile architecture section (line 294) and places settings behind the hamburger menu (line 290). Fase 1 / MVP scope (line 322) names the two mobile roles, confirming profile management is launch-critical. WCAG requirements (lines 32-35) apply universally from day one, driving the accessibility constraints in this feature.

  • docs/source/likeperson.md · line 290
    Settings accessible from hamburger menu
  • docs/source/likeperson.md · line 294
    Contact detail, edit, and peer mentor profile screens
  • docs/source/likeperson.md · line 322
    2 mobilrolle-profiler: Peer Mentor, Coordinator (Organization Admins logger på som Coordinator i app-konteksten)
  • docs/source/likeperson.md · line 32-35
    Kognitiv tilgjengelighet: NHF nevner spesifikt slagrammede. Enkel navigasjon, logisk flyt, ikke for mange valg. Tydelige feilmeldinger med forslag til løsning.

Responsibilities

  • Fetch user profile records from the remote API with fallback to local cache when offline
  • Persist profile updates to the remote API and synchronize local cache on success
  • Invalidate stale cache entries after successful writes
  • Map raw API response shapes to typed UserProfile domain objects
  • Expose typed error objects for network, validation, and authorization failures

Interfaces

findById(userId: string): Promise<UserProfile>
save(userId: string, data: ProfileUpdate): Promise<UserProfile>
invalidateCache(userId: string): void