Service Layer high complexity mobile
2
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Handles client-side validation, upload queuing, and multipart POST submission of attachment files to the backend attachment endpoint. Enforces permitted MIME types and maximum file size before upload; enqueues the upload in the mutation outbox when the device is offline and retries with exponential backoff on reconnect. Stores the server-returned file reference in the local activity_attachments cache.

Feature: Document Attachments

file-upload-service

Sources & reasoning

The implementation notes describe a multipart POST flow with client-side validation, offline queuing in the mutation outbox, and exponential backoff retry. This service encapsulates all upload lifecycle logic so the picker widget remains a pure UI concern. The dependency on the shared Mutation Outbox Service (from offline-sync) allows uploads to survive connectivity interruptions, consistent with how other mutation-producing features handle offline state.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Validate file MIME type and size against permitted limits before upload
  • Perform multipart POST to the backend attachment endpoint
  • Enqueue upload operation in the mutation outbox when offline
  • Retry failed uploads with exponential backoff on reconnect
  • Persist server-returned stored-file reference to local activity_attachments cache

Interfaces

uploadAttachment({required String activityId, required AttachmentFile file}): Future<AttachmentRecord>
validateFile(AttachmentFile file): ValidationResult
retryPending(): Future<void>
getAttachmentsForActivity(String activityId): List<AttachmentRecord>

Relationships

Dependencies (2)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component