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

Description

Orchestrates caregiver CRUD operations, enforcing role-based access rules before delegating reads and writes to CaregiverRepository. Enqueues mutations to the outbox for backend sync when connectivity is available. Resolves Organization Label configuration for the active tenant.

Feature: Caregiver & Next-of-Kin

caregiver-service

Sources & reasoning

Lines 121, 161, and 438 form a clear provenance chain: the requirement is stated (121), marked MUST in Phase 1 (161), and explicitly restated as Phase 1 MUST (438). Blueprint places this in Contacts (not Relatives Database) because it concerns caregivers linked to existing contacts, not a standalone relatives registry. Phase 1 = MVP by ordinal mapping.

  • 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 sak.
  • PĂĄrørende database | âś“ | - | - | - | âś“ | MUST (Barnekreft) | 1
  • PĂĄrørende-database er Fase 1 MUST for Barnekreftforeningen

Responsibilities

  • Enforce role-based access control before allowing add, edit, or delete operations
  • Delegate caregiver reads and writes to CaregiverRepository
  • Enqueue outbox mutations for backend synchronisation on create, update, and delete
  • Resolve active tenant's Organization Label for caregiver terminology
  • Propagate validation errors and conflict signals back to the UI layer

Interfaces

getCaregivers(contactId: string): Promise<Caregiver[]>
addCaregiver(contactId: string, data: CaregiverInput, role: Role): Promise<Caregiver>
updateCaregiver(caregiverId: string, data: CaregiverInput, role: Role): Promise<Caregiver>
deleteCaregiver(caregiverId: string, role: Role): Promise<void>
getOrganizationLabel(tenantId: string): CaregiverLabelConfig

Related Data Entities (1)

Data entities managed by this component