Infrastructure medium complexity mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Provides a thin wrapper around the remote cloud storage API (e.g. Supabase Storage or S3-compatible bucket) used to upload and retrieve attachment files. It constructs authenticated multipart upload requests, handles retry logic for transient network errors, and returns the public or signed URL of successfully stored files. Storage paths are namespaced by organisation and activity ID to facilitate Bufdir audit access.

Feature: Document Attachments

file-storage-client

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.

Responsibilities

  • Upload binary file data to the configured remote storage bucket with multipart support
  • Generate namespaced storage paths keyed on organisation, activity ID, and attachment ID
  • Return a publicly accessible or signed download URL on successful upload
  • Retry failed uploads with exponential backoff up to a configured attempt limit
  • Delete files from remote storage when an attachment is permanently removed

Interfaces

upload(path: string, file: FileHandle, mimeType: string): Promise<string>
delete(path: string): Promise<void>
getSignedUrl(path: string, expiresInSeconds: number): Promise<string>
buildStoragePath(orgId: string, activityId: string, attachmentId: string): string