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

Description

Data access layer for the activity_attachments table that links uploaded files to their parent activities. Stores metadata such as filename, MIME type, size, storage key, and uploader. Provides query methods scoped by activity for retrieval and audit lookups.

Feature: Document Attachments

attachment-store

Sources & reasoning

Matrix row 107 places Dokumentvedlegg at Fase 2 (mapped to Core Product). NHF unique-needs entry explains the Bufdir-evidence motivation and justifies it as a toggleable area-level capability rather than a quick-log addon.

  • Dokumentvedlegg til aktiviteter: Invitasjoner, Facebook-skjermbilder m.m. - viktig for Bufdir-etterprøving.
  • Dokumentvedlegg til aktiviteter | - | âś“ | - | - | âś“ | NICE TO HAVE | 2

Responsibilities

  • Insert attachment metadata rows linked to activity IDs
  • Query attachments by activity ID for display and audit
  • Delete attachment records when activities or files are removed
  • Enforce referential integrity with the activities table
  • Expose uploader and timestamp fields for audit defensibility

Interfaces

insertAttachment(record: AttachmentRecord): AttachmentRecord
findByActivityId(activityId: string): AttachmentRecord[]
findById(attachmentId: string): AttachmentRecord | null
deleteByActivityId(activityId: string): void