Auto-Approval Rules Service
Component Detail
Service Layer
medium complexity
backend
2
Dependencies
1
Dependents
4
Entities
0
Integrations
Description
Server-side evaluation engine that checks all active auto-approval rules for an organization at the moment of expense submission. Evaluates rules in priority order, short-circuits on the first match, and writes matched claims directly to reimbursement_approvals with an auto-approved status. Also handles CRUD operations for rule configuration and emits audit log entries for every auto-approval event.
auto-approval-rules-service
Responsibilities
- Evaluate all active rules for the submitting user's organization in priority order at expense submission time
- Short-circuit rule evaluation on the first matching rule and mark the claim as auto-approved
- Write auto-approved claims directly to reimbursement_approvals with a system actor ID
- Expose CRUD operations for managing auto-approval rule configurations
- Emit structured audit log entries for every auto-approval event for compliance review
Interfaces
evaluateRulesForExpense(expenseId: string, organizationId: string): AutoApprovalResult
createRule(organizationId: string, rule: RuleInput): AutoApprovalRule
updateRule(ruleId: string, rule: Partial<RuleInput>): AutoApprovalRule
deleteRule(ruleId: string): void
toggleRuleActive(ruleId: string, isActive: boolean): AutoApprovalRule
listRules(organizationId: string): AutoApprovalRule[]
previewRuleMatches(rule: RuleInput, organizationId: string): ExpenseClaim[]
Relationships
Dependencies (2)
Components this component depends on
Related Data Entities (4)
Data entities managed by this component