configuration PK: id 10 required 1 unique

Description

Configurable auto-approval rules defining thresholds and conditions under which expense claims are automatically approved without manual attestation. Owned per organization and evaluated by the Rules Engine during expense submission and review.

19
Attributes
4
Indexes
8
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the approval rule
PKrequiredunique
organization_id uuid Owning organization (tenant scope)
required
name string Human-readable name of the rule shown in the admin UI
required
description text Optional longer description of what the rule does and why it exists
-
rule_type enum Category of auto-approval rule
required
expense_type_scope json Array of expense_type IDs this rule applies to. Empty array means all expense types.
-
max_amount decimal Maximum monetary amount (NOK) eligible for auto-approval under this rule
-
max_distance_km decimal Maximum distance in kilometres eligible for auto-approval (e.g. HLF 50 km threshold)
-
receipt_required_threshold decimal Amount above which a receipt photo must accompany the expense (e.g. HLF 100 NOK)
-
conditions json Structured rule definition (operators, fields, values) interpreted by the Rules Engine for composite rules
-
action enum Outcome when rule conditions are met
required
priority integer Evaluation order; lower numbers evaluated first when multiple rules match
required
is_active boolean Whether the rule is currently active and evaluated by the Rules Engine
required
effective_from datetime Timestamp from which the rule becomes effective
-
effective_until datetime Optional expiry timestamp after which the rule no longer applies
-
created_by uuid User (Org Admin) who created the rule
required
updated_by uuid User who last modified the rule
-
created_at datetime Creation timestamp
required
updated_at datetime Last update timestamp
required

Database Indexes

idx_approval_rules_organization_id
btree

Columns: organization_id

idx_approval_rules_org_active_priority
btree

Columns: organization_id, is_active, priority

idx_approval_rules_rule_type
btree

Columns: rule_type

idx_approval_rules_effective_window
btree

Columns: effective_from, effective_until

Validation Rules

name_not_empty error

Validation failed

thresholds_non_negative error

Validation failed

effective_window_valid error

Validation failed

rule_type_requires_fields error

Validation failed

expense_type_scope_valid error

Validation failed

organization_exists error

Validation failed

action_enum_valid error

Validation failed

priority_non_negative_integer error

Validation failed

Business Rules

auto_approve_under_threshold
always

Expenses below configured distance and amount thresholds with no receipts required are automatically approved without manual attestation (HLF: under 50 km / no out-of-pocket).

manual_review_above_threshold
always

Expenses exceeding any active rule's threshold must be routed to the Expense Approval Queue for manual attestation by an Org Admin.

receipt_required_over_threshold
on_create

Auto-approval is denied when expense amount exceeds receipt_required_threshold and no receipt photo is attached (HLF: over 100 NOK).

rule_priority_evaluation
always

When multiple rules match, the rule with the lowest priority value is applied first; the first matching action determines the outcome.

Enforced by: Rules Engine
organization_scoped
always

Rules apply only to expenses within the owning organization; cross-tenant evaluation is forbidden.

effective_window_enforcement
always

Rules outside their effective_from/effective_until window are skipped during evaluation.

Enforced by: Rules Engine
audit_trail_on_change
always

Any create/update/delete on an approval rule must be written to the organization audit log.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage