NotificationPreferenceRepository
Component Detail
Data Layer
medium complexity
mobile
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Handles persistence of user notification preferences, storing them in local device storage and synchronising with the backend API. It abstracts the dual-write strategy so callers do not need to manage local versus remote storage directly. On read, it returns the locally cached version and triggers a background sync when connectivity is available.
notification-preference-repository
Sources & reasoning
User preference control follows from the WCAG cognitive accessibility mandate (line 28) and the need to serve low-digital-skill users. Blueprint marks notification-settings [MVP]. First phase ordinal = MVP. Settings are a standard companion to any notification system.
-
docs/source/likeperson.md · line 290Bottom nav with 5 tabs: Home, Contacts, Add (modal launcher for Activity and Event wizards), Work, Notifications
-
docs/source/likeperson.md · line 28Appen SKAL oppfylle WCAG 2.2 nivå AA som minimumskrav for alle skjermer og interaksjoner - fra dag én, for alle organisasjoner.
Responsibilities
- Read preferences from local storage with fallback to backend API
- Write preferences to local storage immediately for offline resilience
- Synchronise local preferences to backend when network is available
- Handle conflict resolution when local and remote preferences diverge
Interfaces
findByUserId(userId: string): Promise<NotificationPreferences | null>
save(userId: string, prefs: NotificationPreferences): Promise<void>
syncToBackend(userId: string): Promise<void>
clearLocal(userId: string): Promise<void>