Create a New Organizational Unit
From the Organization Tree Screen or a unit detail screen, an authorized administrator can initiate creation of a new organizational unit. The creation form requires the unit name, its organizational type (national association, region, or local association), and its parent in the hierarchy. The Org Structure Service enforces cascade validation to ensure the type-parent relationship is consistent (e.g., a local association must have a region as its parent). The Supabase RLS policy gates this operation to admin-level users only. On success, the new unit immediately appears in the tree at the correct position.
User Story
Acceptance Criteria
- Given I am an authorized administrator, when I tap the create action on the tree screen, then a creation form appears with fields for name, type, and parent selection
- Given I am filling the creation form, when I select 'local association' as the type, then the parent selector only shows regions as valid parent options
- Given I attempt to create a local association with a national association as parent, when I submit, then the form shows a validation error explaining the hierarchy constraint
- Given I fill all required fields correctly, when I submit the form, then the new unit is created and immediately visible in the organization tree at the correct position
- Given a user without admin privileges attempts to access the creation form, when they submit, then the operation is blocked with a permission denied message
- Given the unit is created successfully, when I open the parent unit's detail screen, then the child count has increased by one
Business Value
Organizations regularly charter new local associations as membership grows. Without programmatic unit creation, administrators must request changes through manual processes. Enabling self-service creation with proper validation keeps the hierarchy accurate in real time, which is foundational to correct role-based access assignments and Bufdir reporting roll-ups.
Components
- Organization Tree Screen ui
- Org Level Detail Screen ui
- Org Structure Service service
- Org Structure Repository data
- Org Structure RLS Policy infrastructure