ReceiptUploadService
Component Detail
Service Layer
medium complexity
mobile
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Manages the full lifecycle of receipt photo uploads, including requesting presigned URLs from the backend, queuing uploads in the mutation outbox for offline-first delivery, and linking completed uploads to their parent expense_items row. It ensures uploads are retried automatically when connectivity is restored.
receipt-upload-service
Sources & reasoning
Line 69 explicitly specifies receipt photo capture for expenses over 100 kr for HLF. The parent area is Fase 2 in the priority matrix at line 148, mapping to v1.0 by ordinal phase position.
-
docs/source/likeperson.md · line 69Kvitteringsbilde for utlegg over 100 kr (HLF).
-
docs/source/likeperson.md · line 148Reiserefusjon / utleggsregistrering | - | - | ✓ | ✓ | ✓ | SHOULD HAVE | 2
Responsibilities
- Request a presigned upload URL from the backend for each receipt
- Queue upload tasks in the mutation outbox when the device is offline
- Execute direct-to-object-storage uploads using the presigned URL once online
- Update the expense_items record with the receipt reference upon successful upload
- Emit upload lifecycle events for UI state synchronisation
Interfaces
requestPresignedUrl(expenseItemId: string): Promise<PresignedUploadUrl>
enqueueUpload(image: CompressedImage, expenseItemId: string): void
processOutbox(): Promise<void>
linkReceiptToExpenseItem(expenseItemId: string, receiptUrl: string): Promise<void>
getUploadStatus(expenseItemId: string): UploadStatus