core PK: id 8 required 3 unique

Description

A tenant organization on the Meander platform. Represents a national disability organization (e.g., NHF, Blindeforbundet, HLF) or any sub-unit within its hierarchy. Organizations are the primary multi-tenancy boundary — all operational data (users, activities, expenses, contacts, reports) is scoped to an organization. Supports hierarchical structures (national → regional → local) via a closure table pattern.

17
Attributes
5
Indexes
7
Validation Rules
55
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Globally unique identifier for the organization. Used as the tenant key across all multi-tenant queries.
PKrequiredunique
name string Full legal or display name of the organization (e.g., 'Norges Handikapforbund').
required
slug string URL-safe lowercase identifier used in API paths and routing. Derived from name on creation, immutable after first use in active data.
requiredunique
parent_organization_id uuid Foreign key to the parent organization in the hierarchy. NULL for top-level organizations. Enables multi-level structures (national → regional → local).
-
organization_level enum Position in the organizational hierarchy. Drives scoping logic and admin portal visibility rules.
required
short_name string Abbreviated name used in UI labels, report headers, and notifications (e.g., 'NHF', 'HLF').
-
description text Optional description of the organization's mission or scope. Displayed on the Admin Web Portal organization settings page.
-
logo_url string CDN URL for the organization's uploaded logo. Used in mobile app branding, reports, and admin portal headers.
-
website_url string Public website URL for the organization, shown in admin portal and help sections.
-
contact_email string Primary administrative contact email. Used for system notifications and support routing.
-
contact_phone string Primary contact phone number in E.164 format. Used for SMS notification routing and admin contact display.
-
country_code string ISO 3166-1 alpha-2 country code. Defaults to 'NO' for Norwegian organizations. Drives locale defaults and legal document selection.
required
bufdir_org_id string External organization identifier assigned by Bufdir. Required for automated Bufdir report generation and export. NULL for organizations not receiving Bufdir funding.
unique
active boolean Soft-delete flag. Inactive organizations are hidden from all operational views but preserved for audit history and historical reporting. Never physically deleted.
required
onboarded_at datetime Timestamp when the organization was fully onboarded and activated on the platform. NULL means onboarding is in progress.
-
created_at datetime Record creation timestamp. Set by the database on INSERT.
required
updated_at datetime Last modification timestamp. Updated automatically on any field change.
required

Database Indexes

idx_organizations_slug
btree unique

Columns: slug

idx_organizations_parent_id
btree

Columns: parent_organization_id

idx_organizations_active
btree

Columns: active

idx_organizations_bufdir_org_id
btree unique

Columns: bufdir_org_id

idx_organizations_level_active
btree

Columns: organization_level, active

Validation Rules

name_required_non_empty error

Validation failed

slug_format_valid error

Validation failed

logo_url_valid_format error

Validation failed

contact_email_valid_format error

Validation failed

contact_phone_e164_format error

Validation failed

parent_organization_must_exist_and_be_active error

Validation failed

country_code_iso3166 error

Validation failed

Business Rules

tenant_isolation_enforced
always

Every query touching operational data (activities, users, contacts, expenses, reports) MUST include an organization_id WHERE clause. Cross-organization data access is architecturally forbidden except for Global Admins performing system-level operations. Global Admins may not access org operational content by default.

soft_delete_only
on_delete

Organizations are never physically deleted. Setting active=false deactivates the organization and hides all associated users and data from operational views. Historical audit records are preserved indefinitely. Hard DELETE is not permitted.

circular_hierarchy_prevention
on_create

An organization cannot be set as its own ancestor. Before persisting a parent_organization_id change, the hierarchy service must verify no cycle would be introduced using the closure table ancestry check.

bufdir_id_unique_across_platform
on_create

bufdir_org_id must be globally unique. Two organizations cannot share the same Bufdir identifier, as this would corrupt government grant reporting and audit trails.

slug_immutable_after_use
on_update

Once an organization slug is referenced in active user accounts, JWT tokens, or external integrations, it cannot be changed. The organization-service must check for existing references before allowing a slug update.

Enforced by: Organization Service
hierarchy_level_consistency
on_create

An organization's level (national/regional/local) must be consistent with its position in the closure table. A 'local' organization cannot have children; a 'national' organization can have 'regional' or 'local' children.

deactivation_cascade_warning
on_update

Deactivating an organization must emit a warning if it has active users, pending expense approvals, or unsubmitted Bufdir reports. Deactivation proceeds but all associated active sessions are revoked.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Components Managing This Entity

service Permission Validation Middleware ["backend"] infrastructure Organization Labels Adapter ["mobile"] service Proxy Scope Validator ["mobile"] data Event Store ["backend"] data Event Store ["mobile"] service Event Service ["backend"] service Event Service ["mobile"] data Report Store ["backend"] data Report Store ["backend"] service Report Data Aggregator ["backend"] data Accounting Export Store ["backend"] data Accounting Export Store ["backend"] service Email/SMS Notification Service ["backend"] service Email/SMS Notification Service ["backend"] data Analytics Store ["backend"] data Analytics Store ["backend"] service KPI Access Control Service ["backend"] service KPI Aggregation Service ["backend"] service KPI Aggregation Service ["backend"] service Activity Feed Service ["backend"] service Activity Feed Service ["backend"] service Role Scope Resolver ["backend"] data User Repository ["backend"] data User Repository ["backend"] service Audit Log Service ["backend"] service Audit Log Service ["backend"] data Reimbursement Repository ["backend"] service Reimbursement Service ["backend"] service Reimbursement Service ["backend"] data Report Store ["backend"] data Report Store ["backend"] service Report Access Control Service ["backend"] service Report Generation Service ["backend"] service Report Generation Service ["backend"] data Bufdir Report Store ["backend"] service Bufdir Export Service ["backend"] service Bufdir Export Service ["backend"] service Bufdir Field Mapper ["backend"] service Custom Report Service ["backend"] service Custom Report Service ["backend"] data Organization Config Store ["backend"] data Organization Config Store ["backend"] infrastructure Logo Upload Adapter ["backend"] service Organization Service ["backend"] service Organization Service ["backend"] data Terminology Repository ["backend"] service Terminology Context Provider ["frontend","backend"] service Terminology Service ["backend"] service Terminology Service ["backend"] data Feature Flag Store ["backend"] data Feature Flag Store ["backend"] service Feature Flag Service ["backend"] service Feature Flag Service ["backend"] data Hierarchy Store ["backend"] data Hierarchy Store ["backend"] infrastructure Closure Table Adapter ["backend"] infrastructure Org Scope JWT Resolver ["backend"] service Aggregate Report Service ["backend"] service Hierarchy Access Control Service ["backend"] service Hierarchy Service ["backend"] service Hierarchy Service ["backend"] ui Organization Node Editor ["frontend"] data Association Membership Repository ["backend"] service Association Service ["backend"] service Association Service ["backend"] service Duplicate Reporting Detector ["backend"] data Portal Integration Config Store ["backend"] service External Portal Service ["backend"] service External Portal Service ["backend"] data Accounting Credentials Store ["backend"] data Accounting Export Store ["backend"] data Accounting Export Store ["backend"] service Accounting API Service ["backend"] service Accounting API Service ["backend"] data Security Metrics Repository ["backend"] service Security Monitoring Service ["backend"] service Security Monitoring Service ["backend"] data Audit Log Store ["backend"] data Audit Log Store ["backend"] service Audit Log Service ["backend"] service Audit Log Service ["backend"] service Session Service ["backend"] service Session Service ["backend"]