OrgHierarchyService
Component Detail
Service Layer
medium complexity
backend
0
Dependencies
0
Dependents
5
Entities
0
Integrations
Description
Orchestrates business logic for defining and maintaining multi-level organizational hierarchies. Enforces parent-child relationship constraints, computes activity data rollup across hierarchy levels, and evaluates duplicate-detection rules to prevent the same activity from being claimed at multiple levels simultaneously.
org-hierarchy-service
Sources & reasoning
Line 109 states NHF has 1,400 local associations with a hard requirement that activity attribution across levels be supported. Line 107 adds duplicate-registration detection across coordinator levels. NHF is a Phase 1 launch organization (line 323), making the hierarchy model an MVP requirement.
-
docs/source/likeperson.md · line 109Bredest organisasjonsstruktur: 12 landsforeninger, 9 regioner, 1 400 lokallag - aktivitetsfordeling mellom ledd må støttes.
-
docs/source/likeperson.md · line 107Duplikatvarsling: Fange opp når samme aktivitet registreres av flere koordinatorer.
Responsibilities
- Validate and persist parent-child organization relationships
- Compute activity attribution rollup across national, regional, and local levels
- Evaluate duplicate-detection rules and flag conflicting claims
- Enforce hierarchy depth and structural constraints
- Coordinate with OrgHierarchyRepository for all persistence operations
Interfaces
getHierarchyTree(rootOrgId: string): Promise<OrgNode[]>
createOrgNode(parentId: string, data: OrgNodeInput): Promise<OrgNode>
updateOrgNode(orgId: string, data: Partial<OrgNodeInput>): Promise<OrgNode>
moveOrgNode(orgId: string, newParentId: string): Promise<void>
getRollupConfig(orgId: string): Promise<RollupConfig>
setRollupConfig(orgId: string, config: RollupConfig): Promise<void>
checkDuplicateClaims(activityId: string): Promise<DuplicateClaimResult[]>
Related Data Entities (5)
Data entities managed by this component