Data Layer medium complexity Shared Component mobilebackend
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Drift data component managing the local expenses table, which stores peer mentor travel expense records with foreign keys to users, expense_types, and expense_receipts. Provides CRUD operations and offline mutation outbox support for sync. Also exposes a query interface consumed by the admin-expense-approval area.

Feature: Travel Expense Registration

expenses-data

Sources & reasoning

Central data component for all expense-related features in the expense-reimbursement area. Marked shared because receipt-photo-upload, expense-types-requirements, confidentiality-declarations, and admin-expense-approval all read from or write to the same expenses table.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Persist and retrieve expense records in local Drift database
  • Support filtering by user, status, and date range
  • Track sync status (pending, synced, failed) for each record
  • Expose batch insert for offline backfill scenarios

Interfaces

insert(expense: ExpenseCompanion): Future<int>
findByUser(userId: String): Future<List<Expense>>
findPendingSync(): Future<List<Expense>>
updateStatus(id: int, status: ApprovalStatus): Future<void>
delete(id: int): Future<void>
findById(id: int): Future<Expense?>