Organization Unit Repository
Component Detail
Data Layer
high complexity
Shared Component
backendshared
0
Dependencies
6
Dependents
1
Entities
0
Integrations
Description
Supabase data access layer for the organization_units table which implements a recursive adjacency-list structure (parent_id self-reference). Provides typed Dart models and query methods for fetching subtrees, finding ancestors, and performing safe cascade deletes.
organization-unit-repository
Responsibilities
- CRUD operations against organization_units table
- Recursive subtree queries using Supabase RPC or recursive CTEs
- Return typed OrganizationUnit Dart models
- Handle soft-delete and cascade constraints
Interfaces
fetchAll(organizationId)
fetchById(unitId)
fetchChildren(parentId)
fetchAncestors(unitId)
fetchDescendants(unitId)
insert(organizationId, name, levelType, parentId?)
update(unitId, patch)
softDelete(unitId)
countMembers(unitId)
Relationships
Dependents (6)
Components that depend on this component