Infrastructure medium complexity backend
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Backend infrastructure component that generates short-lived presigned URLs for direct mobile-to-object-storage uploads and stores the resulting receipt metadata in the database. It handles URL expiry, scopes credentials per upload request, and provides read access for coordinators and admins reviewing receipts during expense approval.

Feature: Receipt Photo Upload

receipt-storage-client

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.

Responsibilities

  • Generate expiring presigned PUT URLs scoped to a single receipt upload
  • Store receipt metadata and object storage references in the receipts table
  • Enforce one-to-one receipt-to-expense_item constraint at the storage layer
  • Provide authenticated presigned GET URLs for admin and coordinator receipt review
  • Clean up orphaned objects when an expense item is deleted or its receipt replaced

Interfaces

generateUploadUrl(expenseItemId: string, mimeType: string): PresignedUploadUrl
confirmUpload(expenseItemId: string, objectKey: string): Promise<Receipt>
getReceiptViewUrl(receiptId: string, requesterId: string): Promise<string>
deleteReceipt(receiptId: string): Promise<void>