Reimbursement Store
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
1
Dependents
5
Entities
0
Integrations
Description
Data access layer encapsulating PostgreSQL queries against the reimbursements, expenses, expense_approvals, and users tables. Uses CTEs and window functions for efficient period-based aggregation and per-mentor breakdowns without multiple round trips.
reimbursement-store
Responsibilities
- Execute aggregation queries with CTEs and window functions for period grouping
- Join reimbursements with expenses, expense_approvals, and users for complete records
- Support filtered queries by date range, expense type, and organization
- Provide pagination and sorting for large result sets
Interfaces
queryReimbursements(filters: QueryFilters): ReimbursementRow[]
queryAggregatedStats(orgId: string, period: PeriodFilter): AggregatedStats
queryByExpenseType(orgId: string, filters: QueryFilters): ExpenseTypeRow[]
queryByUser(orgId: string, filters: QueryFilters): UserSummaryRow[]
queryPendingPayouts(orgId: string): PayoutRow[]
countReimbursements(orgId: string, filters: QueryFilters): number
Relationships
Related Data Entities (5)
Data entities managed by this component