RelativesRepository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Data access layer that performs CRUD operations against the dedicated relatives table, keeping relative records cleanly separated from the main contacts namespace. Provides query methods for fetching relatives by their associated primary contact. All persistence logic is isolated here to maintain a single point of database interaction for this domain.
relatives-repository
Sources & reasoning
Barnekreftforeningen explicitly requires registering relatives as independent contact subjects (line 121). Priority matrix confirms MUST with Phase 1 placement (line 161) and the note at line 438 reinforces the Fase 1 mandate. Blueprint marks this feature [MVP]. All downstream relatives-database features depend on this registration capability existing first.
-
docs/source/likeperson.md · line 121Barnekreftforeningen 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
-
docs/source/likeperson.md · line 161Pårørende database | ✓ | - | - | - | ✓ | MUST (Barnekreft) | 1
-
docs/source/likeperson.md · line 438Pårørende-database er Fase 1 MUST for Barnekreftforeningen (se §4 matrisen).
Responsibilities
- Insert new relative records into the relatives table with foreign key reference to the primary contact
- Query relatives by primary contact ID for family-level case views
- Update existing relative records with new profile or communication preference data
- Delete relative records by ID
- Return typed Relative domain objects mapped from raw database rows
Interfaces
create(contactId: string, data: RelativeRegistrationData): Promise<Relative>
findByContactId(contactId: string): Promise<Relative[]>
findById(relativeId: string): Promise<Relative | null>
update(relativeId: string, data: Partial<RelativeRegistrationData>): Promise<Relative>
delete(relativeId: string): Promise<void>