Note Attachment Upload Service
Component Detail
Service Layer
medium complexity
mobile
2
Dependencies
2
Dependents
0
Entities
0
Integrations
Description
Service responsible for picking files or photos from the device using platform file/camera pickers, storing a local file path in note_attachments for offline access, and uploading the binary to the backend REST API when online. Integrates with the mutation outbox so attachments queued offline are uploaded automatically when connectivity returns. Handles cascade deletion of both the local file reference and the backend record.
note-attachment-upload-service
Responsibilities
- Invoke device file picker or camera and receive a local file path
- Insert a note_attachments record with local path and pending-sync status
- Upload file binary to the REST API endpoint and update the record with the remote URL
- Queue failed uploads in the mutation outbox for retry with backoff
- Delete local file path and backend record on attachment removal, cascade from note deletion
Interfaces
pickAndAttach(noteId: String, source: FileSource) -> Future<AttachmentRecord>
uploadPendingAttachments() -> Future<void>
deleteAttachment(attachmentId: String) -> Future<void>
getAttachmentsForNote(noteId: String) -> Stream<List<AttachmentRecord>>
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component