Data Layer low complexity backend
1
Dependencies
3
Dependents
1
Entities
0
Integrations

Description

Data access layer for all receipt records in the PostgreSQL database. Manages CRUD operations on the receipts table, maintains the foreign key relationship to the expenses table, and provides queries for retrieving receipts scoped to specific expenses or organizations. Enforces multi-tenant data isolation so receipt images are never accessible cross-tenant.

Feature: Receipt Photo Upload

receipt-repository

Responsibilities

  • Create receipt records with foreign key reference to parent expense
  • Retrieve receipts by expense ID, user ID, or organization ID
  • Delete receipt records and trigger storage object cleanup
  • Enforce organization-scoped data isolation for all queries
  • Support soft-delete and audit logging for compliance

Interfaces

createReceipt(expenseId, storageUrl, metadata)
getReceiptById(receiptId)
getReceiptsByExpenseId(expenseId)
getReceiptsByOrganizationId(organizationId)
deleteReceipt(receiptId)
softDeleteReceipt(receiptId)
updateReceiptMetadata(receiptId, metadata)
countReceiptsByExpense(expenseId)

Relationships

Dependencies (1)

Components this component depends on

Dependents (3)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component