Receipt Upload Service
Component Detail
Service Layer
medium complexity
mobilebackend
2
Dependencies
2
Dependents
2
Entities
0
Integrations
Description
Orchestrates the full receipt upload workflow: compresses the captured image, sends it to the Next.js backend via multipart POST (/api/v1/receipts), and links the resulting receipt record to the parent expense. Applies client-side threshold validation to prompt for a receipt when expense amounts exceed the configurable limit, with server-side validation as a safeguard.
receipt-upload-service
Responsibilities
- Compress receipt images before upload to balance quality and storage cost
- Send compressed image to backend via multipart POST /api/v1/receipts
- Link uploaded receipt to parent expense record by expense ID
- Enforce client-side threshold rule (prompt for receipt when amount exceeds configured limit)
- Handle upload errors, retries, and offline queuing
Interfaces
uploadReceipt(imageFile, expenseId)
compressImage(imageFile, quality)
linkReceiptToExpense(receiptId, expenseId)
checkThreshold(amount, organizationId)
retryFailedUpload(uploadId)
cancelUpload(uploadId)
getUploadStatus(uploadId)
deleteReceipt(receiptId)
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component
Sub-Components (1)
Receipt Image Compressor
component
low
Applies image compression to receipt photos before upload using Flutter image processing utilities. Balances image quality sufficient for receipt legibility against storage and bandwidth costs.
- Compress images to target file size or quality threshold
- Preserve sufficient resolution for receipt text legibility
- Return compressed image file for upload
Related Data Entities (2)
Data entities managed by this component