Submit Expense Claim with Receipt Stored Securely
When the peer mentor submits an expense claim with an attached receipt, the image is uploaded to Supabase Storage via the receipt storage adapter before the claim record is saved. The storage path and signed URL are persisted to the claim_receipts table linked to the expense claim. Upload progress is shown inline. If the upload fails due to network issues, a retry mechanism is offered. The image is stored with access restricted to users with permission to view that specific claim (RLS enforced). Receipt images are associated with the claim lifecycle — they persist for audit trail purposes even after claim approval.
User Story
Acceptance Criteria
- Given I submit an expense claim with a receipt attached, When the form is submitted, Then the receipt image is uploaded to Supabase Storage before the claim record is created
- Given the upload is in progress, When I am on the submission screen, Then an upload progress indicator is shown so I know the operation is ongoing
- Given the upload completes successfully, When the claim is saved, Then the receipt storage path is linked to the claim record in the database
- Given the network connection drops during upload, When the upload fails, Then a clear error message is shown with a Retry button, and the claim is not submitted in a partial state
- Given a claim with a receipt is submitted, When a coordinator views the claim, Then the receipt image is accessible via a signed URL with appropriate access controls
- Given the claim is approved or rejected, When the receipt record is queried, Then it remains stored and linked to the historical claim for audit trail purposes
Business Value
Secure receipt storage with RLS enforcement is a compliance requirement — expense claims with receipts may contain sensitive financial information. Linking receipts to the claim audit trail satisfies Bufdir reporting requirements for expense documentation. Atomic upload-then-save prevents ghost claims (submitted without receipt) that would be rejected during coordinator review, ensuring the auto-approval pipeline functions correctly for under-threshold claims.
Components
- Receipt Attachment Service service
- Receipt Image Compressor service
- Receipt Storage Repository data
- Claim Receipt Repository data
- Receipt Storage Adapter data
- Expense Submission Service service
- Expense Form BLoC service
- Expense Repository data
- Supabase Storage Adapter infrastructure