Hierarchy Service
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Backend service that manages the organizational hierarchy and enforces structural rules. Handles node CRUD, parent-child validation, and aggregation queries used by reporting.
hierarchy-service
Sources & reasoning
Required by NHF's stated structure (§69) and listed as an Admin Portal core capability (§143). Placed in Core Product because the MVP admin scope (§244-247) lists user management and org settings but not hierarchy, and NHF is the org most needing it after MVP launch.
-
docs/source/likeperson.md · line 69Bredest organisasjonsstruktur: 12 landsforeninger, 9 regioner, 1 400 lokallag - aktivitetsfordeling mellom ledd må støttes.
-
docs/source/likeperson.md · line 143Multi-organization hierarchy management
Responsibilities
- Create, update, move, and delete organizational nodes
- Validate hierarchy integrity (no cycles, single parent per node)
- Enforce double-reporting prevention across nodes
- Resolve subtree membership for scoping users, activities, and reports
- Expose aggregation queries that roll up data from descendants
Interfaces
createOrgNode(parentId, data): OrgNode
moveOrgNode(nodeId, newParentId): OrgNode
getSubtree(nodeId): OrgNode[]
resolveScopeForUser(userId): NodeId[]
checkDoubleReporting(activityId, nodeId): ValidationResult
Related Data Entities (3)
Data entities managed by this component