Threshold Rules Service
Component Detail
Service Layer
high complexity
backend
3
Dependencies
2
Dependents
2
Entities
0
Integrations
Description
Backend service that persists auto-approval rule configuration per tenant and evaluates expense claims synchronously at submission time. Applies structured rule schema (type, operator, value) across all active dimensions and sets claim status to auto_approved when all conditions are met, bypassing the manual queue.
threshold-rules-service
Responsibilities
- Persist and retrieve per-tenant rule configuration from the auto-approval rules table
- Evaluate submitted expense claims against all active tenant rules synchronously
- Set claim status to auto_approved and write audit log entry with rule snapshot on match
- Execute read-only dry-run queries against historical claims for preview requests
- Validate rule schema to prevent injection or contradictory combinations
Interfaces
getRules(orgId): Promise<AutoApprovalRule[]>
saveRules(orgId, rules, actorId): Promise<void>
evaluateClaim(claim, orgId): Promise<AutoApprovalDecision>
previewRuleset(rules, orgId): Promise<RulePreviewResult>
getRuleAuditHistory(orgId): Promise<RuleAuditEntry[]>
Relationships
Dependencies (3)
Components this component depends on
Dependents (2)
Components that depend on this component
Related Data Entities (2)
Data entities managed by this component