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

Description

A backend service that manages the bidirectional association between relative records and contact cases within an organization. It persists link records, enforces organizational boundaries so relatives cannot be linked across organizations, and provides query endpoints that surface the full family unit for a given case or all cases linked to a given relative. It also validates that both the case and the relative exist and belong to the same organization before creating a link.

Feature: Relative Case Linking

case-link-service

Sources & reasoning

The phrase "knyttet til samme sak" (linked to the same case) in line 121 directly specifies that relatives must be associated with a case, not just stored independently. This is the linking mechanism that fulfills that requirement. Phase 1 MUST status confirmed on line 438, mapping to MVP. Without case linking the relatives registration feature has no operational value.

  • docs/source/likeperson.md · line 121-122
    Appen må støtte registrering av pårørende (foreldre, søsken, nærmeste omsorgsperson) som egne kontaktsubjekter knyttet til samme sak.
  • docs/source/likeperson.md · line 438
    Pårørende-database er Fase 1 MUST for Barnekreftforeningen

Responsibilities

  • Create and delete case-relative link records in the database
  • Validate that the case and relative belong to the same organization before linking
  • Query all relatives linked to a given contact case
  • Query all cases linked to a given relative record
  • Enforce uniqueness so the same relative cannot be linked to the same case twice

Interfaces

linkRelativeToCase(caseId: string, relativeId: string, actorId: string): CaseLink
unlinkRelativeFromCase(caseId: string, relativeId: string): void
getRelativesForCase(caseId: string): RelativeRecord[]
getCasesForRelative(relativeId: string): ContactCase[]
validateLink(caseId: string, relativeId: string): ValidationResult

Related Data Entities (2)

Data entities managed by this component