Service Layer medium complexity backendmobile
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Business logic layer responsible for orchestrating all caregiver and next-of-kin operations between the UI and the data repository. It enforces relationship-type validation, ensures a contact cannot exceed a reasonable number of caregiver entries, and coordinates updates so the contact record reflects current caregiver state. It exposes a clean async API consumed by the widget.

Feature: Caregiver & Next-of-Kin

caregiver-service

Sources & reasoning

Line 121 establishes Barnekreftforeningen's need to track caregivers and next-of-kin linked to the same contact case, directly motivating this feature within the Contacts area. Line 467 canonically places Caregiver & Next-of-Kin in the Contacts area taxonomy. The blueprint marks it MVP, consistent with Barnekreftforeningen's Phase 1 MUST requirement for family-linked contact tracking noted in the priority matrix (line 161).

  • docs/source/likeperson.md · line 121
    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)
  • docs/source/likeperson.md · line 467
    | contacts | Contacts | Contact List & Search, Contact Detail & Edit, Caregiver & Next-of-Kin |

Responsibilities

  • Validate relationship type values against an allowed enumeration before persistence
  • Retrieve all caregivers associated with a given contact ID
  • Create new caregiver entries linked to a contact record
  • Update existing caregiver entries and propagate changes to the repository
  • Delete caregiver entries and ensure referential consistency with the contact record

Interfaces

getCaregiversForContact(contactId: string): Promise<Caregiver[]>
addCaregiver(contactId: string, data: CaregiverFormData): Promise<Caregiver>
updateCaregiver(caregiverId: string, data: CaregiverFormData): Promise<Caregiver>
deleteCaregiver(caregiverId: string): Promise<void>
validateRelationshipType(type: string): boolean

Related Data Entities (2)

Data entities managed by this component