Data Layer high complexity Shared Component backend
0
Dependencies
1
Dependents
3
Entities
0
Integrations

Description

Data access layer for the organizations table, exposing the nullable parent_organization_id foreign key structure. Provides recursive SQL query execution for tree traversal and transactional writes for structural changes.

Feature: Multi-Organization Hierarchy

organization-hierarchy-repository

Responsibilities

  • Query organizations table with parent_organization_id joins for tree traversal
  • Execute recursive CTEs for ancestor and descendant chain retrieval
  • Persist new sub-organizations with parent reference
  • Update parent_organization_id for node moves within the tree
  • Delete organization nodes with referential integrity checks

Interfaces

findWithParent(orgId: string): Organization
findDescendants(orgId: string): Organization[]
findAncestors(orgId: string): Organization[]
insertSubOrganization(parentId: string, data: OrgData): Organization
updateParent(orgId: string, newParentId: string): Organization
deleteOrganization(orgId: string): void

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (3)

Data entities managed by this component