Auto-Approval Rule CRUD Service
Component Detail
Service Layer
low complexity
backend
1
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
REST API handler for managing auto-approval rule configuration, used exclusively by the admin portal. Enforces that only Org Admins can modify rules for their own organization and validates rule consistency (e.g., preventing contradictory threshold combinations) before persisting.
auto-approval-rule-crud-service
Responsibilities
- Handle create, read, update, delete operations for auto-approval rules via REST API
- Enforce Org Admin authorization scoped to the caller's organization
- Validate rule field consistency before persistence
- Return paginated rule list with expense type name resolution
Interfaces
createRule(orgId: string, ruleData: CreateRuleDto): AutoApprovalRule
updateRule(orgId: string, ruleId: string, updates: UpdateRuleDto): AutoApprovalRule
deleteRule(orgId: string, ruleId: string): void
listRules(orgId: string): AutoApprovalRule[]
toggleRuleEnabled(orgId: string, ruleId: string, enabled: boolean): AutoApprovalRule
validateRuleData(data: CreateRuleDto): ValidationResult