Reimbursement Service
Component Detail
Service Layer
medium complexity
backend
1
Dependencies
2
Dependents
9
Entities
0
Integrations
Description
Backend service that aggregates reimbursement data from the reimbursements, expenses, expense_approvals, and users tables using PostgreSQL window functions and CTEs. Computes summary statistics grouped by period, expense type, and user, and provides the data layer for both the dashboard UI and the export route.
reimbursement-service
Responsibilities
- Aggregate reimbursement totals by period (month/quarter/year), expense type, and peer mentor
- Compute summary statistics including total reimbursed, pending payout, and per-mentor averages
- Apply date-range and organizational scope filters to all queries
- Provide structured query results for the dashboard and export endpoints
- Enforce organization-level data isolation for multi-tenant access
Interfaces
getReimbursementSummary(orgId: string, period: PeriodFilter): ReimbursementStats
getReimbursementsByPeriod(orgId: string, filters: ReimbursementFilters): ReimbursementRow[]
getReimbursementsByExpenseType(orgId: string, filters: ReimbursementFilters): ExpenseTypeGroup[]
getReimbursementsByUser(orgId: string, filters: ReimbursementFilters): UserReimbursementSummary[]
getPendingPayouts(orgId: string): PendingPayout[]
getReimbursementDetail(reimbursementId: string): ReimbursementDetail
Relationships
Dependents (2)
Components that depend on this component
Related Data Entities (9)
Data entities managed by this component