AttachmentRepository
Component Detail
Data Layer
medium complexity
mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Manages local and remote persistence of attachment metadata records linked to activity entries. It reads and writes attachment records including file URLs, MIME types, sizes, and upload status to the local SQLite database. The repository serves as the source of truth for attachment state and supports offline-first operation through a pending-upload status flag.
attachment-repository
Sources & reasoning
Lines 107-108 give the exact use-case (invitations, screenshots for Bufdir auditing). Line 348 places it in Fase 2 (v1.0). The needs matrix marks it NICE TO HAVE / Fase 2, consistent with should_have at v1.0.
-
docs/source/likeperson.md · line 107-108Dokumentvedlegg til aktiviteter: Invitasjoner, Facebook-skjermbilder m.m. - viktig for Bufdir-etterprøving.
-
docs/source/likeperson.md · line 348Dokumentvedlegg til aktiviteter (NHF)
Responsibilities
- Insert new attachment metadata records with upload status and activity association
- Query all attachments for a given activity ID
- Update upload status and remote URL after successful cloud upload
- Delete attachment records when an attachment is removed by the user
- Return all records with pending-upload status for the offline sync queue
Interfaces
save(attachment: AttachmentRecord): Promise<void>
findByActivityId(activityId: string): Promise<AttachmentRecord[]>
updateUploadStatus(attachmentId: string, status: UploadStatus, url?: string): Promise<void>
delete(attachmentId: string): Promise<void>
getPendingUploads(): Promise<AttachmentRecord[]>