Data Layer medium complexity mobile
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Manages persistence of expense records in the local Drift database with sync support for when connectivity is restored. Links each expense record to its parent activity and tracks sync state per record. Does not handle accounting export - that is delegated to the admin portal accounting module.

Feature: Travel Expense Registration

expense-repository

Sources & reasoning

Lines 66 and 341 explicitly describe the expense registration need for HLF and Blindeforbundet. The priority matrix at line 148 places the parent area as SHOULD HAVE Fase 2, which maps to v1.0 by ordinal phase position.

  • Begge organisasjoner har behov for registrering av kilometergodtgjørelse, bompenger, parkering og kollektivt. Behovene er like, men HLF har mest detaljert krav:
  • Reiserefusjon / utleggsregistrering | - | - | ✓ | ✓ | ✓ | SHOULD HAVE | 2
  • Reiserefusjonshåndtering (faste valg, terskelbasert godkjenning)

Responsibilities

  • Persist new expense records locally with a pending sync flag
  • Link expense records to parent activity records by activity ID
  • Update sync state and remote ID once server confirms receipt
  • Retrieve expenses by activity, status, or date range for display and export preparation
  • Provide offline queue of unsynced records for the sync trigger

Interfaces

save(expense: ExpenseDraft): Promise<ExpenseRecord>
findByActivityId(activityId: string): Promise<ExpenseRecord[]>
findUnsynced(): Promise<ExpenseRecord[]>
markSynced(localId: string, remoteId: string): Promise<void>
findByDateRange(from: Date, to: Date): Promise<ExpenseRecord[]>

Related Data Entities (1)

Data entities managed by this component