Service Layer medium complexity mobile
2
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Riverpod-based repository that wraps Drift queries on the relatives table, providing CRUD operations for caregiver and next-of-kin records linked to a contact. Enforces coordinator-only write access and loads role tags from the relative_roles lookup table for the picker; changes are queued in the mutation outbox for offline-first sync.

Feature: Caregiver & Next-of-Kin

caregiver-link-service

Sources & reasoning

Business logic layer mediating between CaregiverLinkWidget and the Drift/SQLCipher offline store. The implementation notes explicitly reference a Riverpod RelativesRepository wrapping Drift queries on the relatives table, which is the project-standard pattern for offline-first data access.

  • docs/source/likeperson.md · line 121
    Pårørende-database: Barnekreftforeningen jobber primært med familier rundt barn med kreft, ikke kun med de berørte selv. Appen må støtte registrering av pårørende (foreldre, søsken, nærmeste omsorgsperson) som egne kontaktsubjekter knyttet til samme
  • docs/source/likeperson.md · line 151
    Pårørende database | ✓ | - | - | - | MUST (Barnekreft) | 1
  • docs/source/likeperson.md · line 428
    Pårørende-database er Fase 1 MUST for Barnekreftforeningen (se §4 matrisen).

Responsibilities

  • Create, read, update, and delete relative records linked to a contact via Drift
  • Load and cache relative_roles lookup data for the role picker widget
  • Enforce coordinator role gate before any mutating operation
  • Queue caregiver mutations in the offline outbox for background sync

Interfaces

getRelativesForContact(contactId) → Stream<List<Relative>>
addRelative(contactId, data) → Future<Relative>
updateRelative(relativeId, data) → Future<Relative>
removeRelative(relativeId) → Future<void>
getRoleTags() → Future<List<RelativeRole>>

Relationships

Dependencies (2)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component