Approval Repository
Component Detail
Data Layer
medium complexity
mobilebackend
0
Dependencies
0
Dependents
4
Entities
0
Integrations
Description
Data access layer for the reimbursement_approvals table, providing CRUD operations and a Riverpod stream provider that subscribes to real-time Supabase changes. Scopes all queries to the coordinator's organisation to enforce data isolation, and surfaces append-only audit records for the complete approval trail.
approval-repository
Responsibilities
- Provide real-time stream of pending approvals scoped to organisation
- Insert and update approval records via authenticated RPC
- Fetch full approval detail including audit history
- Enforce organisation-scoped data access for coordinators
Interfaces
streamPendingApprovals(orgId: String): Stream<List<ReimbursementApproval>>
getApprovalDetail(approvalId: String): Future<ReimbursementApprovalDetail>
createApprovalRecord(record: ReimbursementApproval): Future<String>
updateApprovalStatus(approvalId: String, status: ApprovalStatus, comment: String?): Future<void>
getAuditHistory(approvalId: String): Future<List<ApprovalEvent>>
getApprovalByReportId(reportId: String): Future<ReimbursementApproval?>
streamApprovalStatus(approvalId: String): Stream<ApprovalStatus>
Related Data Entities (4)
Data entities managed by this component