Data Layer medium complexity backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Persistence layer for auto-approval rule definitions, their activation status, and the audit trail of which rule auto-approved which claim. Provides query access for the engine at evaluation time and for the admin UI when listing or editing rules.

Feature: Auto-Approval Rules

approval-rules-store

Sources & reasoning

HLF's detailed reimbursement requirements explicitly call for threshold-based automatic approval. Phase 2 in §5 lists threshold-based approval as part of Reiserefusjonshåndtering, so target_release is Core Product.

  • Automatisk godkjenning under 50 km / uten utlegg, manuell attestering ellers (HLF).
  • Detaljert refusjonsstyring med faste valg som gjør feilkombinasjon teknisk umulig (f.eks. km + bussbillett kan ikke velges samtidig). Automatisk godkjenning under terskel.

Responsibilities

  • Persist rule definitions with conditions, status, and timestamps
  • Retrieve active rules for the engine on claim submission
  • Record auto-approval audit entries linking claim, rule, and timestamp
  • Support listing, fetching, and soft-deleting rules for the admin UI
  • Provide historical claim access used by simulation

Interfaces

getActiveRules(): Rule[]
getRuleById(ruleId: string): Rule
upsertRule(rule: Rule): Rule
recordAutoApproval(claimId: string, ruleId: string): void
listRules(): RuleSummary[]

Related Data Entities (1)

Data entities managed by this component