User Repository
Component Detail
Data Layer
medium complexity
mobile
0
Dependencies
1
Dependents
1
Entities
0
Integrations
Description
Data access layer for reading and writing user records scoped to their organization tenant. Performs CRUD operations against the users and user_roles tables through the REST API, ensuring all requests carry the correct tenant context headers. Provides a local cache for offline read support and exposes role assignment data needed by the Profile Screen.
user-repository
Responsibilities
- Fetch user record by ID with tenant-scoped authorization headers
- Persist updated profile fields via REST API PUT endpoint
- Read user role assignments from user_roles table through API
- Maintain a local read cache to support offline profile display
Interfaces
getUserById(id: String): Future<User>
updateUser(id: String, fields: Map<String, dynamic>): Future<User>
getUserRoles(userId: String): Future<List<UserRole>>
clearCache(): void