Organization Initialization Service
This service handles the complete initialization of organizations in the CommTool system.
It provides database creation, organization setup, and system user configuration.
Key responsibilities:
- Database schema creation and initialization
- Organization object creation with proper hierarchy
- System user and super admin setup
- Visibility filters and permission configuration
- Multi-tenant organization isolation
Database components initialized:
- ObjectBase: Core objects (organizations, users, jobs)
- Member: Member-specific data and display information
- Links: Relationships between objects (memberSys links)
- Visible: Visibility permissions for users
- Source:
Members
(static, constant) checkOrgaExists
Check if organization exists and create if necessary
This function verifies if an organization exists in the database.
If not found, it automatically creates the organization with default
settings and proper initialization.
- Source:
(static, constant) createDB
Create database and initialize schema
sole use-case: running tests on a fresh database
This function creates a new database if it doesn't exist and initializes
all required tables, views, and functions for the CommTool system.
- Source:
(static, constant) initOrga
Initialize a new organization with complete setup
This is the core function that creates a new organization with all required
components: the organization object, system users, permissions, and filters.
It sets up a complete multi-tenant environment for the organization.
- Source:
Methods
(inner) readFile(path) → {Promise.<string>}
Utility function to read files asynchronously
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | File path to read |
- Source:
Returns:
File contents as UTF-8 string
- Type
- Promise.<string>