Service Layer high complexity backend
0
Dependencies
0
Dependents
5
Entities
0
Integrations

Description

Core business logic service managing all CRUD operations for the organizational hierarchy. Enforces cascade validation to prevent orphaned nodes, applies Supabase RLS admin-gate on write operations, and supports bulk CSV import with error reporting.

Feature: Organization Structure Management

org-structure-service

Responsibilities

  • CRUD for national associations, regions, and local associations
  • Cascade validation to prevent orphaned child nodes
  • Enforce admin-level write permissions via RLS
  • Bulk import from parsed CSV data with validation

Interfaces

getHierarchy(organizationId)
createNationalAssociation(data)
createRegion(data, nationalAssociationId)
createLocalAssociation(data, regionId)
updateOrgLevel(nodeId, level, data)
deleteOrgLevel(nodeId, level)
validateCascadeDelete(nodeId, level)
bulkImportFromCsv(rows)
getOrgLevelById(nodeId, level)
searchOrgUnits(query)