Auto-Approval Rules Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
2
Dependents
0
Entities
0
Integrations
Description
PostgreSQL data access layer for the auto_approval_rules configuration table. Stores and retrieves rules scoped to organizations, with fields for expense_type_id, max_amount, max_distance_km, require_receipt, priority_order, and is_active. Provides ordered reads for the rule evaluation engine.
auto-approval-rules-repository
Responsibilities
- Persist auto-approval rule configurations scoped to individual organizations
- Return active rules for an organization ordered by priority for evaluation engine use
- Support CRUD operations for rule management from the service layer
- Enforce uniqueness and referential integrity constraints against expense_types
Interfaces
findActiveRulesByOrganization(organizationId: string): AutoApprovalRule[]
findById(ruleId: string): AutoApprovalRule | null
create(rule: NewAutoApprovalRule): AutoApprovalRule
update(ruleId: string, updates: Partial<AutoApprovalRule>): AutoApprovalRule
delete(ruleId: string): void
setActive(ruleId: string, isActive: boolean): AutoApprovalRule
Relationships
Dependents (2)
Components that depend on this component