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

Description

Backend service responsible for reading, writing, and validating the semantic role field on case link records. It resolves available role options from the Organization Labels system for the requesting organization and enforces that only valid configured role values are persisted. It exposes the necessary endpoints consumed by the widget and any automated role assignment logic.

Feature: Relative Role Tagging

relative-role-service

Sources & reasoning

Line 121 enumerates distinct relative types - foreldre (parents), søsken (siblings), nærmeste omsorgsperson (primary caregiver) - implying role differentiation is a first-class requirement, not just a free-text note. Phase 1/MVP is confirmed by the priority matrix (line 161). Role tagging gives structured, queryable meaning to the type enumeration and is marked [MVP] in the blueprint alongside the other relatives-database features.

  • 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

Responsibilities

  • Persist the assigned role value to the case link record in the database
  • Retrieve valid role labels for the organization from the Organization Labels system
  • Validate that a submitted role value exists in the organization's configured label set
  • Return the current role for a given case link record on read requests
  • Support bulk retrieval of roles for a list of case link IDs for list views

Interfaces

assignRole(caseLinkId: string, role: string, orgId: string): Promise<CaseLink>
getRole(caseLinkId: string): Promise<string | null>
getAvailableRoles(orgId: string): Promise<RoleLabel[]>
bulkGetRoles(caseLinkIds: string[]): Promise<Record<string, string | null>>

Related Data Entities (1)

Data entities managed by this component