Data Layer medium complexity backend
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Handles all persistence operations for consent records and consent text versions in the server-side data store. It provides queryable access to historical consent records keyed by mentor, assignment, and data category. Ensures that the exact consent text version shown at the time of agreement is stored alongside every consent event for audit and compliance purposes.

Feature: Progressive Digital Consent

consent-repository

Sources & reasoning

Line 101 explicitly calls out gradual digitization of mandates (fullmakter) and medical summaries with a manual fallback, which maps directly to progressive consent. Line 94 establishes that epikrise (medical summaries) are transmitted-a category requiring explicit GDPR consent. The area sits in Fase 2 per line 153, normalising to v1.0. Consent is a legal prerequisite for the encrypted-assignment-dispatch feature and cannot be deferred.

  • docs/source/likeperson.md · line 101
    Gradvis digitalisering av fullmakter og epikriser med manuelt fallback.
  • docs/source/likeperson.md · line 94
    Kryptert oppdragshåndtering: Sende sensitive personopplysninger (navn, adresse, epikrise) til likepersoner med leveringsbekreftelse og lesebekreftelse.
  • docs/source/likeperson.md · line 153
    Kryptert oppdragshåndtering | - | - | ✓ | - | ✓ | MUST (Blindeforbundet) | 2

Responsibilities

  • Save new consent records with mentor ID, assignment ID, data category, text version, and timestamp
  • Query consent records by mentor and data category to check prior consent coverage
  • Retrieve all consent records for a given assignment for audit display
  • Store and retrieve versioned consent text definitions per data category
  • Support soft-deletion or invalidation of consent records when text versions change

Interfaces

saveConsentRecord(record: ConsentRecord): Promise<ConsentRecord>
findConsent(mentorId: string, dataCategory: DataCategory, textVersion: string): Promise<ConsentRecord | null>
findAllForAssignment(assignmentId: string): Promise<ConsentRecord[]>
getActiveConsentText(dataCategory: DataCategory): Promise<ConsentTextVersion>
invalidateConsent(consentId: string): Promise<void>