Service Layer medium complexity backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

A backend service responsible for validating expense entries against the active expense type configuration for an organisation. It enforces required fields, documentation requirements, and mutual-exclusion rules defined per type. Validation results include structured error messages suitable for display in both mobile and admin interfaces.

Feature: Expense Types & Requirements

expense-type-validation-service

Sources & reasoning

Lines 67 and 112 both explicitly require fixed type choices with technical enforcement of mutual exclusivity, framed as a hard HLF requirement. This is part of Reiserefusjonshåndtering in the Phase 2 roadmap (line 343), placing it at v1.0.

  • docs/source/likeperson.md · line 67
    Faste valg for utleggstype - ikke fritekst - for å hindre feilkombinasjon (f.eks. både km og bussbillett).
  • docs/source/likeperson.md · line 112
    Detaljert refusjonsstyring med faste valg som gjør feilkombinasjon teknisk umulig (f.eks. km + bussbillett kan ikke velges samtidig). Automatisk godkjenning under terskel.

Responsibilities

  • Validate that required fields are present for the selected expense type
  • Enforce mutual-exclusion rules and reject invalid type combinations
  • Check that documentation attachments meet type-specific requirements
  • Return structured validation errors keyed to specific fields
  • Apply the correct org-level configuration when validating entries

Interfaces

validate(entry: ExpenseEntry, orgId: string): ValidationResult
getMutualExclusions(typeId: string, orgId: string): string[]
getRequiredFields(typeId: string, orgId: string): FieldRequirement[]

Related Data Entities (3)

Data entities managed by this component