Infrastructure medium complexity backendshared
1
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Utility service that validates the structural integrity of the organization hierarchy before and after mutations. Checks for orphaned nodes, cycle introduction, depth limit violations, and missing level assignments. Used by the hierarchy service and admin portal to surface validation errors to the operator.

Feature: Organizational Hierarchy & Structure Management

hierarchy-validator

Responsibilities

  • Detect circular parent-child references before insert
  • Enforce maximum hierarchy depth per organization type
  • Check for orphaned nodes after delete operations
  • Validate level type ordering matches organization configuration

Interfaces

validateNoCircle(unitId, newParentId, existingTree)
validateDepth(unitId, maxDepth)
validateOrphanFree(deletedUnitId, tree)
validateLevelOrder(units, levelConfig)
runFullValidation(organizationId)

Relationships

Dependencies (1)

Components this component depends on

Related Data Entities (1)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/hierarchy-validation 7 endpoints
GET /api/v1/hierarchy-validation List recent validation results for an organization
GET /api/v1/hierarchy-validation/{validationId} Get a specific validation result
POST /api/v1/hierarchy-validation/circle-check Validate that setting a new parent does not create a circular reference
POST /api/v1/hierarchy-validation/depth-check Validate that adding a unit does not exceed max hierarchy depth
POST /api/v1/hierarchy-validation/orphan-check Validate that deleting a unit leaves no orphaned children
PUT /api/v1/hierarchy-validation/{validationId} Update a validation record (e.g. annotate with resolution)
+1 more