Expense Type Catalogue Repository
Component Detail
Description
Repository managing the configurable catalogue of expense types and their mutual exclusion group definitions. Fetches the catalogue from Supabase on startup and caches locally for offline validation. Supports organisation-specific catalogue overrides.
expense-type-catalogue-repository
Summaries
The Expense Type Catalogue Repository enables organisations to define and enforce their own expense policies without requiring custom software development for each client. By supporting organisation-specific catalogue overrides, the business can serve enterprise customers with unique reimbursement rules — a key competitive differentiator in the expense management market. The offline caching capability ensures employees can submit and validate expenses even in low-connectivity environments such as travel or field work, directly reducing friction that would otherwise cause delayed or incomplete submissions. Mutual exclusion group enforcement reduces erroneous claims at the point of entry, cutting downstream audit and correction costs and strengthening compliance posture across all customer organisations.
This is a low-complexity component with no declared external dependencies, making it a low-risk deliverable suitable for early-sprint implementation. It runs across both mobile and backend execution contexts, so coordination with both the mobile and API teams is required to align caching strategies and cache invalidation timing. Key delivery considerations include: defining the cache refresh policy (startup-only vs. periodic), testing offline validation scenarios to ensure the local cache remains consistent, and building organisation-override logic that doesn't introduce regression for default-catalogue organisations.
QA should cover catalogue fetch failures (network down on startup), stale cache edge cases, and multi-org isolation to prevent catalogue bleed between organisations.
This data-layer component wraps Supabase queries for the expense type catalogue and exposes a clean domain interface consumed primarily by the validation service for exclusive-group enforcement. On startup it calls Supabase to hydrate the local cache, then serves all subsequent requests from memory to minimise latency and support offline operation. Key interfaces include `getCatalogue(organizationId)` and `getExclusiveGroups()` which the mutual-exclusion validation logic depends on directly, and `refreshCatalogue(organizationId)` for triggered cache invalidation. Organisation-level overrides should be resolved at fetch time and merged before caching, so consumers always receive a fully resolved catalogue.
Data models are `expense-type-catalogue` and `expense-type`. Cache invalidation strategy and TTL policy should be defined in configuration rather than hardcoded to simplify future tuning.
Responsibilities
- Fetch expense type catalogue with exclusive_groups field from Supabase
- Cache catalogue locally for offline access and fast validation
- Provide exclusive_groups lookup for the validation service
- Support organisation-level catalogue configuration overrides
Interfaces
getCatalogue(organizationId)
getExclusiveGroups()
getExpenseTypeById(typeId)
refreshCatalogue(organizationId)
getActiveTypes(organizationId)
Relationships
Dependents (3)
Components that depend on this component
Related Data Entities (1)
Data entities managed by this component