Migrate Event Badges to V3 and implement Core Management pages
- Completed V3 migration for Event Badge CRUD operations - Implemented User module V3 logic and editable fields - Created management routes for Accounts, Sites, Users, and Lookups - Updated Site Domain logic to use 'fqdn' and show 'access_key' - Modernized Core Dashboard with navigation cards - Restored Dexie User table definition
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:25 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `account`
|
||||
--
|
||||
|
||||
CREATE TABLE `account` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`code` varchar(50) DEFAULT NULL,
|
||||
`name` varchar(200) DEFAULT NULL,
|
||||
`short_name` varchar(20) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`hide` tinyint(1) DEFAULT 0,
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_from` datetime DEFAULT NULL,
|
||||
`enable_to` datetime DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `account`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_account` BEFORE INSERT ON `account` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_account` BEFORE UPDATE ON `account` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `account`
|
||||
--
|
||||
ALTER TABLE `account`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD UNIQUE KEY `code` (`code`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `name` (`name`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `account`
|
||||
--
|
||||
ALTER TABLE `account`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,124 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:25 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `data_store`
|
||||
--
|
||||
|
||||
CREATE TABLE `data_store` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`for_type` varchar(50) DEFAULT NULL,
|
||||
`for_id` int(11) DEFAULT NULL,
|
||||
`person_id` int(11) DEFAULT NULL COMMENT 'the creator or owner',
|
||||
`user_id` int(11) DEFAULT NULL COMMENT 'the creator or owner',
|
||||
`code` varchar(75) NOT NULL COMMENT 'adding a record that matches an existing code should always have an account_id',
|
||||
`name` varchar(150) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`type` varchar(10) NOT NULL DEFAULT 'html' COMMENT 'html, json, md, text',
|
||||
`json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'case sensitive',
|
||||
`text` longtext DEFAULT NULL COMMENT 'case insensitive',
|
||||
`meta_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`meta_json`)),
|
||||
`meta_text` longtext DEFAULT NULL,
|
||||
`access_read` varchar(20) DEFAULT NULL COMMENT '''super'', ''administrator'', ''trusted'', ''anonymous''',
|
||||
`access_write` varchar(20) DEFAULT NULL COMMENT '''super'', ''administrator'', ''trusted'', ''anonymous''',
|
||||
`access_delete` varchar(20) DEFAULT NULL COMMENT '''super'', ''administrator'', ''trusted'', ''anonymous''',
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `data_store`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_data_store` BEFORE INSERT ON `data_store` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_data_store` BEFORE UPDATE ON `data_store` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `data_store`
|
||||
--
|
||||
ALTER TABLE `data_store`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `code` (`code`),
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `for_type` (`for_type`,`for_id`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `group` (`group`),
|
||||
ADD KEY `hide` (`hide`),
|
||||
ADD KEY `account_id_2` (`account_id`,`for_type`,`for_id`,`code`,`enable`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `data_store`
|
||||
--
|
||||
ALTER TABLE `data_store`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,259 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:24 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `event`
|
||||
--
|
||||
|
||||
CREATE TABLE `event` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`code` varchar(100) DEFAULT NULL,
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`poc_event_person_id` int(11) DEFAULT NULL COMMENT 'use this when possible',
|
||||
`poc_person_id` int(11) DEFAULT NULL COMMENT 'use this only if needed',
|
||||
`external_person_id` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'person ID generated by external system',
|
||||
`user_id` int(11) DEFAULT NULL COMMENT 'user that owns the event',
|
||||
`lu_event_type_id` int(11) DEFAULT NULL,
|
||||
`conference` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes allows for abstracts, sessions, presentations, presenters, badges, etc',
|
||||
`type` varchar(50) DEFAULT NULL,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`summary` text DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`format` text DEFAULT NULL COMMENT 'format of the event',
|
||||
`lu_time_zone_id` int(11) DEFAULT NULL,
|
||||
`timezone` varchar(100) DEFAULT NULL,
|
||||
`start_datetime` datetime DEFAULT NULL,
|
||||
`end_datetime` datetime DEFAULT NULL,
|
||||
`recurring` tinyint(1) DEFAULT NULL COMMENT 'recurring event',
|
||||
`recurring_pattern` varchar(50) DEFAULT NULL,
|
||||
`recurring_start_time` time DEFAULT NULL COMMENT 'recurring event start time',
|
||||
`recurring_end_time` time DEFAULT NULL COMMENT 'recurring event end time',
|
||||
`recurring_text` text DEFAULT NULL COMMENT 'text describing how and when the event recurs',
|
||||
`weekday_sunday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_monday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_tuesday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_wednesday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_thursday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_friday` tinyint(1) DEFAULT NULL,
|
||||
`weekday_saturday` tinyint(1) DEFAULT NULL,
|
||||
`address_location_id` int(11) DEFAULT NULL,
|
||||
`location_address_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`location_address_json_ext` longtext GENERATED ALWAYS AS (json_unquote(json_extract(`location_address_json`,'$'))) STORED,
|
||||
`location_text` text DEFAULT NULL COMMENT 'text information about the location',
|
||||
`online_start` datetime DEFAULT NULL,
|
||||
`online_end` datetime DEFAULT NULL,
|
||||
`reg_deadline_1` datetime DEFAULT NULL,
|
||||
`reg_deadline_2` datetime DEFAULT NULL,
|
||||
`reg_deadline_3` datetime DEFAULT NULL,
|
||||
`reg_deadline_4` datetime DEFAULT NULL,
|
||||
`max_registrants` int(11) DEFAULT NULL,
|
||||
`private` tinyint(1) DEFAULT 0 COMMENT 'invite only event',
|
||||
`physical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'physical in person event',
|
||||
`virtual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'virtual remote access event',
|
||||
`image_path` varchar(500) DEFAULT NULL,
|
||||
`logo_path` varchar(500) DEFAULT NULL,
|
||||
`logo_bg_color` varchar(25) DEFAULT NULL,
|
||||
`banner_path` varchar(500) DEFAULT NULL,
|
||||
`banner_bg_color` varchar(25) DEFAULT NULL,
|
||||
`logo_filename` varchar(200) DEFAULT NULL,
|
||||
`banner_image_filename` varchar(200) DEFAULT NULL,
|
||||
`banner_html` text DEFAULT NULL,
|
||||
`site_h1` varchar(500) DEFAULT NULL,
|
||||
`site_h2` varchar(500) DEFAULT NULL,
|
||||
`external_url` varchar(500) DEFAULT NULL,
|
||||
`external_url_text` varchar(500) DEFAULT NULL,
|
||||
`attend_url` varchar(500) DEFAULT NULL,
|
||||
`attend_url_text` varchar(500) DEFAULT NULL,
|
||||
`attend_url_code` varchar(50) DEFAULT NULL COMMENT 'id, code, nickname, alias',
|
||||
`attend_url_passcode` varchar(50) DEFAULT NULL,
|
||||
`attend_phone` varchar(50) DEFAULT NULL,
|
||||
`attend_phone_passcode` varchar(50) DEFAULT NULL,
|
||||
`attend_text` text DEFAULT NULL,
|
||||
`attend_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attend_json`)),
|
||||
`contact_1_id` int(11) DEFAULT NULL,
|
||||
`contact_2_id` int(11) DEFAULT NULL,
|
||||
`contact_3_id` int(11) DEFAULT NULL,
|
||||
`contact_li_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`contact_li_json`)),
|
||||
`contact_li_json_ext` longtext GENERATED ALWAYS AS (json_unquote(json_extract(`contact_li_json`,'$'))) STORED,
|
||||
`contact_name` varchar(200) DEFAULT NULL,
|
||||
`contact_email` varchar(254) DEFAULT NULL,
|
||||
`contact_phone` varchar(50) DEFAULT NULL,
|
||||
`contact_other` text DEFAULT NULL,
|
||||
`contact_text` text DEFAULT NULL,
|
||||
`event_file_upload_information` text DEFAULT NULL,
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`enable_from` datetime DEFAULT NULL,
|
||||
`enable_to` datetime DEFAULT NULL,
|
||||
`enable_for_administrator` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_support` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_assistant` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_trusted` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_authenticated` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_anonymous` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_comments` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`send_moderator_email` tinyint(1) DEFAULT NULL,
|
||||
`moderator_email` varchar(254) DEFAULT NULL,
|
||||
`disable_navigation` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_event_file_upload_for_event` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_for_location` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_for_session` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_for_presentation` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_for_presenter` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_review_question` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_email_question` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_upload_comments_question` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_approval_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_public_use_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_member_use_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_attendee_use_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_publish_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_purpose_option` tinyint(1) DEFAULT NULL,
|
||||
`enable_event_file_os_selection_option` tinyint(1) DEFAULT NULL COMMENT 'allow selection between macOS and Windows',
|
||||
`enable_event_file_os_change_option` tinyint(1) DEFAULT NULL,
|
||||
`custom_event_file_upload_description` text DEFAULT NULL,
|
||||
`custom_event_file_agreement_1_text` text DEFAULT NULL,
|
||||
`custom_event_file_agreement_1_description` text DEFAULT NULL,
|
||||
`ask_speaker_ready_room` tinyint(1) DEFAULT NULL,
|
||||
`ask_presentation_publish_optout` tinyint(1) DEFAULT NULL,
|
||||
`default_event_file_to_public_use` tinyint(1) DEFAULT NULL,
|
||||
`ask_for_public_version` tinyint(1) DEFAULT NULL,
|
||||
`hide_file_upload_presentation_name` tinyint(1) DEFAULT NULL,
|
||||
`hide_session_codes` tinyint(1) DEFAULT NULL,
|
||||
`custom_agreement_1_text` text DEFAULT NULL,
|
||||
`custom_agreement_1_description` text DEFAULT NULL,
|
||||
`unauthenticated_access` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`unauthenticated_access_public_endpoint` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`mod_abstracts_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_abstracts_json`)),
|
||||
`mod_badges_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'badges config options' CHECK (json_valid(`mod_badges_json`)),
|
||||
`mod_exhibits_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'exhibits config options' CHECK (json_valid(`mod_exhibits_json`)),
|
||||
`mod_meetings_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_meetings_json`)),
|
||||
`mod_pres_mgmt_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_pres_mgmt_json`)),
|
||||
`cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'config in JSON format' CHECK (json_valid(`cfg_json`)),
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`status` varchar(25) DEFAULT NULL,
|
||||
`review` tinyint(1) DEFAULT NULL,
|
||||
`approve` tinyint(1) DEFAULT NULL,
|
||||
`ready` tinyint(1) DEFAULT NULL,
|
||||
`ready_on` datetime DEFAULT NULL,
|
||||
`archive` tinyint(1) DEFAULT NULL,
|
||||
`archive_on` datetime DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches',
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `event`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_event` BEFORE INSERT ON `event` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_default_qry_str(NEW.id_random, NEW.type, NEW.name, NEW.description, NEW.timezone, NEW.recurring_pattern, NEW.recurring_text, NEW.location_text, NEW.attend_text, NEW.contact_text);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_event` BEFORE UPDATE ON `event` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_default_qry_str(NEW.id_random, NEW.type, NEW.name, NEW.description, NEW.timezone, NEW.recurring_pattern, NEW.recurring_text, NEW.location_text, NEW.attend_text, NEW.contact_text);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `event_after_delete` AFTER DELETE ON `event` FOR EACH ROW BEGIN
|
||||
DELETE FROM event_person WHERE event_person.id = old.poc_event_person_id;
|
||||
DELETE FROM address WHERE address.for_id = old.id AND address.for_type = 'event';
|
||||
DELETE FROM address WHERE address.id = old.address_location_id;
|
||||
DELETE FROM contact WHERE contact.for_id = old.id AND contact.for_type = 'event';
|
||||
DELETE FROM contact WHERE contact.id = old.contact_1_id;
|
||||
DELETE FROM contact WHERE contact.id = old.contact_2_id;
|
||||
DELETE FROM contact WHERE contact.id = old.contact_3_id;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `event`
|
||||
--
|
||||
ALTER TABLE `event`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `conference` (`conference`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `archive` (`archive`),
|
||||
ADD KEY `address_location_id` (`address_location_id`) USING HASH,
|
||||
ADD KEY `poc_event_person_id` (`poc_event_person_id`) USING HASH,
|
||||
ADD KEY `contact_id_1` (`contact_1_id`) USING HASH,
|
||||
ADD KEY `contact_id_2` (`contact_2_id`) USING HASH,
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `hide` (`hide`);
|
||||
ALTER TABLE `event` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`);
|
||||
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_location_address_json` (`location_address_json`);
|
||||
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_contact_li_json` (`contact_li_json`);
|
||||
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_location_address_json_ext` (`location_address_json_ext`);
|
||||
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_contact_li_json_ext` (`contact_li_json_ext`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `event`
|
||||
--
|
||||
ALTER TABLE `event`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,235 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:24 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `event_badge`
|
||||
--
|
||||
|
||||
CREATE TABLE `event_badge` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) NOT NULL,
|
||||
`external_id` varchar(100) DEFAULT NULL,
|
||||
`external_event_id` varchar(75) DEFAULT NULL COMMENT 'externally generated event ID',
|
||||
`external_registration_id` varchar(75) DEFAULT NULL COMMENT 'registration ID generated by external system (was external_reg_id)',
|
||||
`external_person_id` varchar(75) DEFAULT NULL COMMENT 'person ID generated by external system (was external_sys_id)',
|
||||
`event_id_only` int(11) DEFAULT NULL COMMENT 'This should only be used when the event_person record can not be created.',
|
||||
`event_person_id` int(11) DEFAULT NULL,
|
||||
`event_badge_template_id` int(11) DEFAULT NULL COMMENT 'if null then use the "default" template for the event',
|
||||
`pronouns` varchar(50) DEFAULT NULL COMMENT 'preferred pronouns',
|
||||
`pronouns_override` varchar(50) DEFAULT NULL COMMENT 'override for pronouns',
|
||||
`informal_name` varchar(50) DEFAULT NULL COMMENT 'nickname',
|
||||
`title_names` varchar(100) DEFAULT NULL COMMENT 'prefix',
|
||||
`given_name` varchar(50) DEFAULT NULL COMMENT 'first name',
|
||||
`middle_name` varchar(50) DEFAULT NULL,
|
||||
`family_name` varchar(100) DEFAULT NULL COMMENT 'last name',
|
||||
`designations` varchar(100) DEFAULT NULL COMMENT 'designations and suffix',
|
||||
`professional_title` varchar(150) DEFAULT NULL COMMENT 'includes degrees and credentials',
|
||||
`professional_title_override` varchar(200) DEFAULT NULL COMMENT 'override for professional title',
|
||||
`full_name` varchar(200) DEFAULT NULL,
|
||||
`full_name_override` varchar(150) DEFAULT NULL COMMENT 'was display_name',
|
||||
`affiliations` text DEFAULT NULL,
|
||||
`affiliations_override` varchar(200) DEFAULT NULL COMMENT 'override for affiliations',
|
||||
`email` varchar(254) DEFAULT NULL,
|
||||
`email_override` varchar(254) DEFAULT NULL COMMENT 'override for email',
|
||||
`phone` varchar(25) DEFAULT NULL,
|
||||
`phone_override` varchar(25) DEFAULT NULL COMMENT 'override for phone',
|
||||
`address_line_1` varchar(200) DEFAULT NULL,
|
||||
`address_line_2` varchar(200) DEFAULT NULL,
|
||||
`address_line_3` varchar(200) DEFAULT NULL,
|
||||
`city` varchar(100) DEFAULT NULL,
|
||||
`country_subdivision_code` varchar(8) DEFAULT NULL,
|
||||
`state_province` varchar(100) DEFAULT NULL,
|
||||
`state_province_abb` varchar(10) DEFAULT NULL COMMENT 'state/province abbreviation',
|
||||
`postal_code` varchar(25) DEFAULT NULL,
|
||||
`country_alpha_2_code` varchar(2) DEFAULT NULL,
|
||||
`country` varchar(100) DEFAULT NULL,
|
||||
`full_address` varchar(200) DEFAULT NULL,
|
||||
`location` varchar(200) DEFAULT NULL,
|
||||
`location_override` varchar(200) DEFAULT NULL COMMENT 'override for location',
|
||||
`location_short` varchar(100) DEFAULT NULL COMMENT 'auto gen with trigger',
|
||||
`location_long` varchar(200) DEFAULT NULL COMMENT 'auto gen with trigger',
|
||||
`query_str` varchar(150) DEFAULT NULL,
|
||||
`badge_type_code` varchar(50) DEFAULT NULL,
|
||||
`badge_type_code_override` varchar(50) DEFAULT NULL,
|
||||
`badge_type` varchar(100) DEFAULT NULL,
|
||||
`badge_type_override` varchar(100) DEFAULT NULL,
|
||||
`member_type_code` varchar(50) DEFAULT NULL,
|
||||
`member_type` varchar(100) DEFAULT NULL,
|
||||
`member_status` varchar(50) DEFAULT NULL,
|
||||
`registration_type_code` varchar(50) DEFAULT NULL,
|
||||
`registration_type` varchar(100) DEFAULT NULL,
|
||||
`other_1` varchar(100) DEFAULT NULL,
|
||||
`other_2` varchar(100) DEFAULT NULL,
|
||||
`ticket_1_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_2_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_3_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_4_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_5_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_6_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_7_code` varchar(100) DEFAULT NULL,
|
||||
`ticket_8_code` varchar(100) DEFAULT NULL,
|
||||
`allow_tracking` tinyint(1) DEFAULT NULL,
|
||||
`allow_tracking_field_li` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '[''given_name'', ''family_name'', ''email'']' CHECK (json_valid(`allow_tracking_field_li`)),
|
||||
`agree_to_tc` tinyint(1) DEFAULT NULL COMMENT 'agree to terms and conditions',
|
||||
`print_first_datetime` datetime DEFAULT NULL,
|
||||
`print_last_datetime` datetime DEFAULT NULL,
|
||||
`print_count` int(11) DEFAULT NULL,
|
||||
`data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)),
|
||||
`cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`cfg_json`)),
|
||||
`hide` tinyint(1) DEFAULT 0,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`enable` tinyint(1) DEFAULT 1,
|
||||
`default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches',
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `event_badge`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_event_badge` BEFORE INSERT ON `event_badge` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.full_name = name_for_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
IF (NEW.location IS NULL OR NEW.location = '')
|
||||
THEN
|
||||
SET NEW.location = make_location_str(NEW.city, NEW.state_province, NEW.country);
|
||||
END IF;
|
||||
|
||||
IF (NEW.full_address IS NULL OR NEW.full_address = '')
|
||||
THEN
|
||||
SET NEW.full_address = make_full_address_str(NEW.address_line_1, NEW.address_line_2, NEW.address_line_3, NEW.city, NEW.state_province, NEW.postal_code, NEW.country);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty full_address');*/
|
||||
END IF;
|
||||
|
||||
IF (NEW.city IS NOT NULL OR NEW.state_province IS NOT NULL OR NEW.country IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.location_long = badge_full_address(NEW.city, NEW.state_province, NEW.country);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty location');*/
|
||||
END IF;
|
||||
|
||||
IF (NEW.city IS NOT NULL OR NEW.state_province_abb IS NOT NULL OR NEW.country_alpha_2_code IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.location_short = badge_location_short(NEW.city, NEW.state_province_abb, NEW.country_alpha_2_code);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty location');*/
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_badge_default_qry_str(NEW.id_random, NEW.full_name, NEW.full_name_override, NEW.affiliations, NEW.affiliations_override, NEW.email, NEW.email_override, NEW.location, NEW.location_override);
|
||||
SET NEW.query_str = badge_query_str(NEW.id_random, NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.email);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_event_badge` BEFORE UPDATE ON `event_badge` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
END IF;
|
||||
|
||||
SET NEW.full_name = name_for_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
IF (NEW.location IS NULL OR NEW.location = '')
|
||||
THEN
|
||||
SET NEW.location = make_location_str(NEW.city, NEW.state_province, NEW.country);
|
||||
END IF;
|
||||
|
||||
IF (NEW.full_address IS NULL OR NEW.full_address = '')
|
||||
THEN
|
||||
SET NEW.full_address = make_full_address_str(NEW.address_line_1, NEW.address_line_2, NEW.address_line_3, NEW.city, NEW.state_province, NEW.postal_code, NEW.country);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty full_address');*/
|
||||
END IF;
|
||||
|
||||
IF (NEW.city IS NOT NULL OR NEW.state_province IS NOT NULL OR NEW.country IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.location_long = badge_full_address(NEW.city, NEW.state_province, NEW.country);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty location');*/
|
||||
END IF;
|
||||
|
||||
IF (NEW.city IS NOT NULL OR NEW.state_province_abb IS NOT NULL OR NEW.country_alpha_2_code IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.location_short = badge_location_short(NEW.city, NEW.state_province_abb, NEW.country_alpha_2_code);
|
||||
/*SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty location');*/
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_badge_default_qry_str(NEW.id_random, NEW.full_name, NEW.full_name_override, NEW.affiliations, NEW.affiliations_override, NEW.email, NEW.email_override, NEW.location, NEW.location_override);
|
||||
SET NEW.query_str = badge_query_str(NEW.id_random, NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.email);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `event_badge`
|
||||
--
|
||||
ALTER TABLE `event_badge`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `external_id` (`external_id`),
|
||||
ADD KEY `event_person_id` (`event_person_id`),
|
||||
ADD KEY `given_name` (`given_name`),
|
||||
ADD KEY `family_name` (`family_name`),
|
||||
ADD KEY `display_name` (`full_name_override`),
|
||||
ADD KEY `email` (`email`),
|
||||
ADD KEY `badge_type_code` (`badge_type_code`),
|
||||
ADD KEY `member_type_code` (`member_type_code`),
|
||||
ADD KEY `registration_type_code` (`registration_type_code`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `external_event_id` (`external_event_id`),
|
||||
ADD KEY `event_badge_template_id` (`event_badge_template_id`);
|
||||
ALTER TABLE `event_badge` ADD FULLTEXT KEY `query_str` (`query_str`);
|
||||
ALTER TABLE `event_badge` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `event_badge`
|
||||
--
|
||||
ALTER TABLE `event_badge`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,242 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:25 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `event_file`
|
||||
--
|
||||
|
||||
CREATE TABLE `event_file` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`hosted_file_id` int(11) DEFAULT NULL,
|
||||
`for_type` varchar(50) DEFAULT NULL,
|
||||
`for_id` int(11) DEFAULT NULL,
|
||||
`event_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_session_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_presentation_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_presenter_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_location_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_track_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`event_exhibit_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`filename` varchar(255) DEFAULT NULL,
|
||||
`extension` varchar(10) DEFAULT NULL,
|
||||
`title` varchar(500) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`internal_use` tinyint(1) DEFAULT NULL COMMENT 'hide from non-support people',
|
||||
`internal_start_datetime` datetime DEFAULT NULL,
|
||||
`internal_end_datetime` datetime DEFAULT NULL,
|
||||
`internal_filename` varchar(255) DEFAULT NULL,
|
||||
`internal_extension` varchar(10) DEFAULT NULL,
|
||||
`open_in_os` varchar(50) DEFAULT NULL COMMENT 'change to open_in: [mac,win,local browser/client,remote browser/client,api,websocket,download]',
|
||||
`internal_hide` tinyint(1) DEFAULT NULL,
|
||||
`private_use` tinyint(1) DEFAULT NULL,
|
||||
`private_start_datetime` datetime DEFAULT NULL,
|
||||
`private_end_datetime` datetime DEFAULT NULL,
|
||||
`private_filename` varchar(255) DEFAULT NULL,
|
||||
`private_extension` varchar(10) DEFAULT NULL,
|
||||
`private_hide` tinyint(1) DEFAULT NULL,
|
||||
`public_use` tinyint(1) DEFAULT NULL,
|
||||
`public_start_datetime` datetime DEFAULT NULL,
|
||||
`public_end_datetime` datetime DEFAULT NULL,
|
||||
`public_filename` varchar(255) DEFAULT NULL,
|
||||
`public_extension` varchar(10) DEFAULT NULL,
|
||||
`public_hide` tinyint(1) DEFAULT NULL,
|
||||
`lu_file_purpose_id` int(11) DEFAULT NULL,
|
||||
`file_purpose` varchar(100) DEFAULT NULL,
|
||||
`publish_optout` tinyint(1) DEFAULT NULL,
|
||||
`download_start_datetime` datetime DEFAULT NULL,
|
||||
`download_end_datetime` datetime DEFAULT NULL,
|
||||
`approved` int(11) DEFAULT NULL,
|
||||
`approved_on` timestamp NULL DEFAULT NULL,
|
||||
`public` tinyint(1) DEFAULT NULL,
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`enable_after_datetime` datetime DEFAULT NULL,
|
||||
`enable_before_datetime` datetime DEFAULT NULL,
|
||||
`enable_for_administrator` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_support` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_assistant` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_trusted` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_for_authenticated` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`review` tinyint(1) DEFAULT NULL,
|
||||
`approve` tinyint(1) DEFAULT NULL,
|
||||
`ready` tinyint(1) DEFAULT NULL,
|
||||
`ready_datetime` datetime DEFAULT NULL,
|
||||
`archive` tinyint(1) DEFAULT NULL,
|
||||
`archive_datetime` datetime DEFAULT NULL,
|
||||
`enable_for_anonymous` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `event_file`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_event_file` BEFORE INSERT ON `event_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_event_file_fix_ids` BEFORE INSERT ON `event_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.for_type = 'event_location' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_location_id = NEW.for_id;
|
||||
SET NEW.event_id = (SELECT event_id FROM event_location WHERE event_location.id = NEW.for_id);
|
||||
END IF;
|
||||
|
||||
IF (NEW.for_type = 'event_presenter' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_presenter_id = NEW.for_id;
|
||||
SET NEW.event_presentation_id = (SELECT event_presentation_id FROM event_presenter WHERE event_presenter.id = NEW.for_id);
|
||||
SET NEW.event_session_id = (SELECT event_session_id FROM event_presentation WHERE event_presentation.id = NEW.event_presentation_id);
|
||||
SET NEW.event_location_id = (SELECT event_location_id FROM event_session WHERE event_session.id = NEW.event_session_id);
|
||||
SET NEW.event_id = (SELECT event_id FROM event_session WHERE event_session.id = NEW.event_session_id);
|
||||
END IF;
|
||||
|
||||
IF (NEW.for_type = 'event_session' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_session_id = NEW.for_id;
|
||||
SET NEW.event_location_id = (SELECT event_location_id FROM event_session WHERE event_session.id = NEW.for_id);
|
||||
SET NEW.event_id = (SELECT event_id FROM event_session WHERE event_session.id = NEW.for_id);
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_event_file` BEFORE UPDATE ON `event_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_event_file_fix_ids` BEFORE UPDATE ON `event_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.for_type = 'event_location' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_location_id = NEW.for_id;
|
||||
SET NEW.event_id = (SELECT event_id FROM event_location WHERE event_location.id = NEW.for_id);
|
||||
END IF;
|
||||
|
||||
IF (NEW.for_type = 'event_presenter' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_presenter_id = NEW.for_id;
|
||||
SET NEW.event_presentation_id = (SELECT event_presentation_id FROM event_presenter WHERE event_presenter.id = NEW.for_id);
|
||||
SET NEW.event_session_id = (SELECT event_session_id FROM event_presentation WHERE event_presentation.id = NEW.event_presentation_id);
|
||||
SET NEW.event_location_id = (SELECT event_location_id FROM event_session WHERE event_session.id = NEW.event_session_id);
|
||||
SET NEW.event_id = (SELECT event_id FROM event_session WHERE event_session.id = NEW.event_session_id);
|
||||
END IF;
|
||||
|
||||
IF (NEW.for_type = 'event_session' AND NEW.for_id IS NOT NULL)
|
||||
THEN
|
||||
SET NEW.event_session_id = NEW.for_id;
|
||||
SET NEW.event_location_id = (SELECT event_location_id FROM event_session WHERE event_session.id = NEW.for_id);
|
||||
SET NEW.event_id = (SELECT event_id FROM event_session WHERE event_session.id = NEW.for_id);
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `event_file_after_delete` AFTER DELETE ON `event_file` FOR EACH ROW BEGIN
|
||||
DELETE FROM hosted_file_link WHERE hosted_file_link.hosted_file_id = OLD.hosted_file_id AND hosted_file_link.link_to_type = OLD.for_type AND hosted_file_link.link_to_id = OLD.for_id;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `event_file_after_insert` AFTER INSERT ON `event_file` FOR EACH ROW BEGIN
|
||||
INSERT IGNORE INTO hosted_file_link (hosted_file_id, link_to_type, link_to_id) VALUES (NEW.hosted_file_id, NEW.for_type, NEW.for_id);
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `update approved_on` BEFORE UPDATE ON `event_file` FOR EACH ROW IF NEW.approved = 1 THEN SET NEW.approved_on = CURRENT_TIMESTAMP; END IF
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `event_file`
|
||||
--
|
||||
ALTER TABLE `event_file`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD UNIQUE KEY `hosted_file_id_for` (`hosted_file_id`,`for_type`,`for_id`),
|
||||
ADD KEY `event_session_id` (`event_session_id`),
|
||||
ADD KEY `event_id` (`event_id`),
|
||||
ADD KEY `hosted_file_id` (`hosted_file_id`),
|
||||
ADD KEY `event_presentation_id` (`event_presentation_id`),
|
||||
ADD KEY `event_presenter_id` (`event_presenter_id`),
|
||||
ADD KEY `event_location_id` (`event_location_id`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `event_track_id` (`event_track_id`),
|
||||
ADD KEY `event_exhibit_id` (`event_exhibit_id`),
|
||||
ADD KEY `hide` (`hide`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `for_type` (`for_type`,`for_id`),
|
||||
ADD KEY `filename` (`filename`),
|
||||
ADD KEY `extension` (`extension`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `event_file`
|
||||
--
|
||||
ALTER TABLE `event_file`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,201 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:26 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `event_session`
|
||||
--
|
||||
|
||||
CREATE TABLE `event_session` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`external_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`code` varchar(100) DEFAULT NULL,
|
||||
`number` int(11) DEFAULT NULL,
|
||||
`for_type` varchar(50) DEFAULT NULL COMMENT 'avoid using',
|
||||
`for_id` int(11) DEFAULT NULL COMMENT 'avoid using',
|
||||
`event_id` int(11) DEFAULT NULL,
|
||||
`event_type_id` int(11) DEFAULT NULL,
|
||||
`type_id` int(11) DEFAULT NULL COMMENT 'not used',
|
||||
`type_code` varchar(25) DEFAULT NULL COMMENT 'from client',
|
||||
`event_location_id` int(11) DEFAULT NULL,
|
||||
`event_track_id` int(11) DEFAULT NULL,
|
||||
`poc_event_person_id` int(11) DEFAULT NULL COMMENT 'still needed?',
|
||||
`poc_person_id` int(11) DEFAULT NULL,
|
||||
`poc_agree` tinyint(1) DEFAULT NULL COMMENT 'catchall for agreement or consent',
|
||||
`poc_kv_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'advocate, chair, champion, moderator, organizer',
|
||||
`passcode` varchar(25) DEFAULT NULL COMMENT 'for basic access',
|
||||
`name` varchar(300) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`proposal_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'responses to proposal questions in JSON format' CHECK (json_valid(`proposal_json`)),
|
||||
`start_datetime` datetime DEFAULT NULL,
|
||||
`end_datetime` datetime DEFAULT NULL,
|
||||
`attend_url` text DEFAULT NULL,
|
||||
`attend_url_text` text DEFAULT NULL,
|
||||
`attend_url_passcode` varchar(15) DEFAULT NULL,
|
||||
`attend_phone` varchar(15) DEFAULT NULL,
|
||||
`attend_phone_passcode` varchar(15) DEFAULT NULL,
|
||||
`attend_text` text DEFAULT NULL,
|
||||
`rehearsal_start_datetime` datetime DEFAULT NULL,
|
||||
`rehearsal_end_datetime` datetime DEFAULT NULL,
|
||||
`rehearsal_url` text DEFAULT NULL,
|
||||
`rehearsal_url_passcode` varchar(15) DEFAULT NULL COMMENT 'remove field?',
|
||||
`rehearsal_phone` varchar(15) DEFAULT NULL COMMENT 'remove field?',
|
||||
`rehearsal_phone_passcode` varchar(15) DEFAULT NULL COMMENT 'remove field?',
|
||||
`rehearsal_text` text DEFAULT NULL,
|
||||
`image_path` varchar(7) DEFAULT NULL COMMENT 'remove field?',
|
||||
`download_start_datetime` datetime DEFAULT NULL,
|
||||
`download_end_datetime` datetime DEFAULT NULL,
|
||||
`internal_use` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'hide from non-support people',
|
||||
`record_audio` tinyint(1) DEFAULT 0 COMMENT 'record presentations',
|
||||
`record_video` tinyint(1) DEFAULT 0 COMMENT 'record presentations',
|
||||
`internal_notes` text DEFAULT NULL COMMENT 'general notes',
|
||||
`internal_notes_access` text DEFAULT NULL COMMENT 'accessibility and accommodations',
|
||||
`internal_notes_av` text DEFAULT NULL COMMENT 'audio video',
|
||||
`internal_notes_fb` text DEFAULT NULL COMMENT 'food and beverage',
|
||||
`internal_notes_it` text DEFAULT NULL COMMENT 'IT and networking',
|
||||
`internal_notes_staff` text DEFAULT NULL COMMENT 'staffing and labor',
|
||||
`ux_mode` varchar(50) DEFAULT NULL COMMENT 'colloquium, lecture, panel, poster, symposium, workshop; replaces type_code',
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`enable_after_datetime` datetime DEFAULT NULL,
|
||||
`enable_before_datetime` datetime DEFAULT NULL,
|
||||
`enable_event_file_approval_option` tinyint(1) DEFAULT NULL,
|
||||
`hide` tinyint(1) DEFAULT 0,
|
||||
`public` tinyint(1) DEFAULT NULL,
|
||||
`public_hide` tinyint(1) DEFAULT NULL,
|
||||
`hide_event_launcher` tinyint(1) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`review` tinyint(1) DEFAULT NULL COMMENT 'ready for or needs review',
|
||||
`approve` tinyint(1) DEFAULT NULL COMMENT 'approved',
|
||||
`ready` tinyint(1) DEFAULT NULL,
|
||||
`ready_on` datetime DEFAULT NULL,
|
||||
`archive` tinyint(1) DEFAULT NULL,
|
||||
`archive_on` datetime DEFAULT NULL,
|
||||
`alert` tinyint(1) DEFAULT NULL,
|
||||
`alert_msg` text DEFAULT NULL COMMENT 'a short message from user',
|
||||
`priority` tinyint(1) DEFAULT 0,
|
||||
`sort` int(11) DEFAULT 0,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches',
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `event_session`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `after_update_event_session` AFTER UPDATE ON `event_session` FOR EACH ROW BEGIN
|
||||
IF (NEW.event_location_id) THEN
|
||||
UPDATE `event_file`
|
||||
SET `event_file`.event_location_id = NEW.event_location_id
|
||||
WHERE `event_file`.event_session_id = OLD.id OR (`event_file`.for_type = 'event_session' AND `event_file`.for_id = OLD.id);
|
||||
END IF;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_event_session` BEFORE INSERT ON `event_session` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_session_default_qry_str(NEW.id_random, NEW.name, NEW.description, NEW.code, NEW.type_code, NEW.start_datetime);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_event_session` BEFORE UPDATE ON `event_session` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = event_session_default_qry_str(NEW.id_random, NEW.name, NEW.description, NEW.code, NEW.type_code, NEW.start_datetime);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `event_session_after_delete` AFTER DELETE ON `event_session` FOR EACH ROW BEGIN
|
||||
DELETE FROM event_file WHERE event_file.for_type = 'event_session' AND event_file.for_id = OLD.id;
|
||||
|
||||
DELETE FROM event_presentation WHERE event_presentation.event_session_id = OLD.id;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `event_session`
|
||||
--
|
||||
ALTER TABLE `event_session`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `event_id` (`event_id`),
|
||||
ADD KEY `start_datetime` (`start_datetime`),
|
||||
ADD KEY `event_location_id` (`event_location_id`),
|
||||
ADD KEY `poc_event_person_id` (`poc_event_person_id`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `hide` (`hide`),
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `name` (`name`),
|
||||
ADD KEY `external_id` (`external_id`),
|
||||
ADD KEY `code` (`code`),
|
||||
ADD KEY `event_track_id` (`event_track_id`),
|
||||
ADD KEY `hide_event_launcher` (`hide_event_launcher`),
|
||||
ADD KEY `type_code` (`type_code`),
|
||||
ADD KEY `poc_person_id` (`poc_person_id`),
|
||||
ADD KEY `poc_agree` (`poc_agree`);
|
||||
ALTER TABLE `event_session` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `event_session`
|
||||
--
|
||||
ALTER TABLE `event_session`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,121 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 03, 2026 at 12:03 AM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `hosted_file`
|
||||
--
|
||||
|
||||
CREATE TABLE `hosted_file` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`hash_sha256` varchar(64) DEFAULT NULL,
|
||||
`account_id` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`title` varchar(500) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`version` int(11) DEFAULT NULL,
|
||||
`directory_path` varchar(1000) DEFAULT NULL,
|
||||
`subdirectory_path` varchar(1000) DEFAULT NULL COMMENT 'new as of 2021-08-26',
|
||||
`filename` varchar(255) DEFAULT NULL,
|
||||
`extension` varchar(10) DEFAULT NULL,
|
||||
`content_type` varchar(100) DEFAULT NULL,
|
||||
`mimetype` varchar(100) DEFAULT NULL,
|
||||
`size` int(11) UNSIGNED DEFAULT NULL COMMENT 'bytes',
|
||||
`cloud_storage` text DEFAULT NULL,
|
||||
`owner_user_id` int(11) DEFAULT NULL,
|
||||
`group_user_id` int(11) DEFAULT NULL,
|
||||
`package_name` varchar(500) DEFAULT NULL,
|
||||
`hide` tinyint(1) DEFAULT 0,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`enable` tinyint(1) DEFAULT 1,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `hosted_file`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_hosted_file` BEFORE INSERT ON `hosted_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_hosted_file` BEFORE UPDATE ON `hosted_file` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `hosted_file`
|
||||
--
|
||||
ALTER TABLE `hosted_file`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD UNIQUE KEY `hash_sha256` (`hash_sha256`),
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `filename` (`filename`),
|
||||
ADD KEY `extension` (`extension`),
|
||||
ADD KEY `hide` (`hide`),
|
||||
ADD KEY `enable` (`enable`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `hosted_file`
|
||||
--
|
||||
ALTER TABLE `hosted_file`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,52 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 03, 2026 at 12:03 AM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `hosted_file_link`
|
||||
--
|
||||
|
||||
CREATE TABLE `hosted_file_link` (
|
||||
`account_id` int(11) DEFAULT NULL COMMENT 'is this needed?',
|
||||
`hosted_file_id` int(11) NOT NULL,
|
||||
`link_to_type` varchar(50) NOT NULL COMMENT 'change to for_object_type',
|
||||
`link_to_id` int(11) NOT NULL COMMENT 'change to for_object_id',
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='All hosted files that are actively linked or in use';
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `hosted_file_link`
|
||||
--
|
||||
ALTER TABLE `hosted_file_link`
|
||||
ADD PRIMARY KEY (`hosted_file_id`,`link_to_type`,`link_to_id`) USING BTREE;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,138 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 02, 2026 at 10:18 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `journal`
|
||||
--
|
||||
|
||||
CREATE TABLE `journal` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`person_id` int(11) DEFAULT NULL,
|
||||
`user_id` int(11) DEFAULT NULL,
|
||||
`type_code` varchar(25) DEFAULT NULL,
|
||||
`default_private` tinyint(1) DEFAULT NULL COMMENT 'default to private',
|
||||
`default_public` tinyint(1) DEFAULT NULL COMMENT 'default to public',
|
||||
`default_personal` tinyint(1) DEFAULT NULL COMMENT 'default to personal',
|
||||
`default_professional` tinyint(1) DEFAULT NULL COMMENT 'default to professional',
|
||||
`private_passcode` varchar(20) DEFAULT NULL COMMENT 'passcode to show private entries',
|
||||
`public_passcode` varchar(20) DEFAULT NULL COMMENT 'passcode to show only public entries',
|
||||
`name` varchar(250) NOT NULL,
|
||||
`short_name` varchar(25) DEFAULT NULL,
|
||||
`summary` text DEFAULT NULL,
|
||||
`outline` text DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`description_html` text DEFAULT NULL,
|
||||
`description_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`description_json`)),
|
||||
`alert` tinyint(1) DEFAULT NULL,
|
||||
`alert_msg` text DEFAULT NULL,
|
||||
`allow_auth` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`auth_key` varchar(25) DEFAULT NULL,
|
||||
`passcode` varchar(25) DEFAULT NULL,
|
||||
`passcode_timeout` int(11) NOT NULL DEFAULT 300 COMMENT 'in seconds',
|
||||
`cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`cfg_json`)),
|
||||
`data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)),
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`archive_on` datetime DEFAULT NULL,
|
||||
`archive` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `journal`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_journal` BEFORE INSERT ON `journal` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
/* SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); */
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
/* SET NEW.default_qry_str = journal_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.description); */
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_journal` BEFORE UPDATE ON `journal` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N');
|
||||
/* SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN'); */
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
/* SET NEW.default_qry_str = journal_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.description); */
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `journal_after_delete` AFTER DELETE ON `journal` FOR EACH ROW BEGIN
|
||||
DELETE FROM journal_entry WHERE journal_entry.journal_id = OLD.id;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `journal`
|
||||
--
|
||||
ALTER TABLE `journal`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `account_id` (`account_id`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `journal`
|
||||
--
|
||||
ALTER TABLE `journal`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,166 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 02, 2026 at 10:19 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `journal_entry`
|
||||
--
|
||||
|
||||
CREATE TABLE `journal_entry` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`journal_id` int(11) NOT NULL,
|
||||
`code` varchar(20) DEFAULT NULL,
|
||||
`lu_type_id` int(11) DEFAULT NULL,
|
||||
`type` varchar(50) DEFAULT NULL,
|
||||
`topic_id` int(11) DEFAULT NULL,
|
||||
`topic` varchar(50) DEFAULT NULL,
|
||||
`activity_id` int(11) DEFAULT NULL,
|
||||
`activity` varchar(50) DEFAULT NULL,
|
||||
`private` tinyint(1) DEFAULT NULL COMMENT 'implies encryption if possible',
|
||||
`public` tinyint(1) DEFAULT NULL,
|
||||
`personal` tinyint(1) DEFAULT NULL,
|
||||
`professional` tinyint(1) DEFAULT NULL,
|
||||
`name` varchar(250) DEFAULT NULL,
|
||||
`short_name` varchar(25) DEFAULT NULL,
|
||||
`summary` text DEFAULT NULL,
|
||||
`content` text DEFAULT NULL,
|
||||
`content_html` text DEFAULT NULL,
|
||||
`content_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`content_json`)),
|
||||
`content_encrypted` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`history` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'content history',
|
||||
`history_encrypted` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'content history encrypted',
|
||||
`passcode_hash` varchar(64) DEFAULT NULL COMMENT 'to match with index',
|
||||
`template` tinyint(1) DEFAULT NULL COMMENT 'use as template entry',
|
||||
`type_code` varchar(25) DEFAULT NULL,
|
||||
`topic_code` varchar(25) DEFAULT NULL,
|
||||
`category_code` varchar(25) DEFAULT NULL,
|
||||
`tags` varchar(255) DEFAULT NULL COMMENT 'comma delimited list',
|
||||
`start_datetime` datetime DEFAULT NULL,
|
||||
`end_datetime` datetime DEFAULT NULL,
|
||||
`seconds` int(11) DEFAULT NULL,
|
||||
`hours` decimal(3,2) DEFAULT NULL,
|
||||
`timezone` varchar(50) DEFAULT NULL,
|
||||
`location` text DEFAULT NULL COMMENT 'probably an address',
|
||||
`latitude` float DEFAULT NULL,
|
||||
`longitude` float DEFAULT NULL,
|
||||
`billable` tinyint(1) DEFAULT 0,
|
||||
`billable_to_id` int(11) DEFAULT NULL,
|
||||
`billiable_to` varchar(100) DEFAULT NULL,
|
||||
`alert` tinyint(1) DEFAULT NULL,
|
||||
`alert_msg` text DEFAULT NULL,
|
||||
`data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)),
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`archive_on` datetime DEFAULT NULL,
|
||||
`archive` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches',
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `journal_entry`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_journal_entry` BEFORE INSERT ON `journal_entry` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = journal_entry_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.content, NEW.history, NEW.category_code, NEW.tags, NEW.alert_msg, NEW.data_json);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_journal_entry` BEFORE UPDATE ON `journal_entry` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
|
||||
/* SET NEW.id_random = gen_rand_str(11, 'URL'); */
|
||||
END IF;
|
||||
|
||||
SET NEW.default_qry_str = journal_entry_default_qry_str(NEW.id_random, NEW.name, NEW.summary, NEW.content, NEW.history, NEW.category_code, NEW.tags, NEW.alert_msg, NEW.data_json);
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `journal_entry`
|
||||
--
|
||||
ALTER TABLE `journal_entry`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `journal_id` (`journal_id`),
|
||||
ADD KEY `tags` (`tags`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `hide` (`hide`),
|
||||
ADD KEY `status` (`status`),
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `archive` (`archive`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `group` (`group`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `start_datetime` (`start_datetime`),
|
||||
ADD KEY `private` (`private`),
|
||||
ADD KEY `public` (`public`),
|
||||
ADD KEY `personal` (`personal`),
|
||||
ADD KEY `professional` (`professional`),
|
||||
ADD KEY `name` (`name`);
|
||||
ALTER TABLE `journal_entry` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `journal_entry`
|
||||
--
|
||||
ALTER TABLE `journal_entry`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,213 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:23 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `person`
|
||||
--
|
||||
|
||||
CREATE TABLE `person` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`source_code` varchar(25) DEFAULT NULL,
|
||||
`external_id` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`external_sys_id` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'generated by external system',
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`user_id` int(11) DEFAULT NULL,
|
||||
`organization_id` int(11) DEFAULT NULL,
|
||||
`informal_name` varchar(50) DEFAULT NULL COMMENT 'nickname',
|
||||
`title_names` varchar(100) DEFAULT NULL COMMENT 'prefix',
|
||||
`given_name` varchar(50) NOT NULL DEFAULT '' COMMENT 'first name',
|
||||
`middle_name` varchar(50) DEFAULT NULL,
|
||||
`family_name` varchar(50) DEFAULT NULL COMMENT 'last name',
|
||||
`designations` varchar(175) DEFAULT NULL COMMENT 'designations and suffix',
|
||||
`professional_title` varchar(100) DEFAULT NULL COMMENT ' includes degrees and credentials ',
|
||||
`full_name` varchar(150) DEFAULT NULL COMMENT 'set by triggers',
|
||||
`full_name_override` varchar(150) DEFAULT NULL COMMENT 'was display_name',
|
||||
`last_first_name` varchar(50) DEFAULT NULL COMMENT 'set by triggers',
|
||||
`informal_full_name` varchar(150) DEFAULT NULL COMMENT 'set by triggers',
|
||||
`affiliations` varchar(200) DEFAULT NULL,
|
||||
`primary_email` varchar(254) DEFAULT NULL,
|
||||
`tagline` text DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`biography` text DEFAULT NULL,
|
||||
`birth_date` date DEFAULT NULL,
|
||||
`death_date` date DEFAULT NULL,
|
||||
`lu_gender_id` int(11) DEFAULT NULL,
|
||||
`lu_sexuality_id` int(11) DEFAULT NULL,
|
||||
`lu_race_id` int(11) DEFAULT NULL,
|
||||
`lu_ethnicity_id` int(11) DEFAULT NULL,
|
||||
`language_native` varchar(2) DEFAULT NULL,
|
||||
`language_primary` varchar(2) DEFAULT NULL,
|
||||
`language_secondary` varchar(2) DEFAULT NULL,
|
||||
`lu_education_degree_id` int(11) DEFAULT NULL,
|
||||
`lu_education_level_id` int(11) DEFAULT NULL,
|
||||
`photo_path` varchar(2500) DEFAULT NULL,
|
||||
`photo_bg_color` varchar(25) DEFAULT NULL,
|
||||
`thumbnail_path` varchar(2500) DEFAULT NULL,
|
||||
`thumbnail_bg_color` varchar(25) DEFAULT NULL,
|
||||
`email_allowed` tinyint(1) DEFAULT NULL COMMENT 'global opt in or out for person',
|
||||
`paper_mail_allowed` tinyint(1) DEFAULT NULL COMMENT 'global opt in or out for person',
|
||||
`stripe_customer_id` varchar(50) DEFAULT NULL,
|
||||
`allow_auth_key` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'defaults to true',
|
||||
`auth_key` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`passcode` varchar(25) DEFAULT NULL COMMENT 'for basic access',
|
||||
`status` varchar(25) DEFAULT NULL COMMENT 'pending, hold, approved, rejected, banned, retired, deceased',
|
||||
`status_id` int(11) DEFAULT NULL COMMENT 'not sure if using yet 2022-03-15',
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL,
|
||||
`group` varchar(100) DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'config options' CHECK (json_valid(`cfg_json`)),
|
||||
`data_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data_json`)),
|
||||
`other_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`meta_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`meta_json`)),
|
||||
`enable` tinyint(1) DEFAULT 1,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information that generally does not change often or ever.';
|
||||
|
||||
--
|
||||
-- Triggers `person`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_person` BEFORE INSERT ON `person` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_person_names` BEFORE INSERT ON `person` FOR EACH ROW BEGIN
|
||||
SET NEW.full_name = name_for_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
SET NEW.last_first_name = name_for_last_first_name(NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
|
||||
SET NEW.informal_full_name = name_for_informal_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
/*
|
||||
IF (NEW.full_name_override IS NULL OR NEW.full_name_override = '')
|
||||
THEN
|
||||
SET NEW.full_name_override = name_for_display_name(NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
END IF;
|
||||
*/
|
||||
|
||||
/*
|
||||
IF (NEW.informal_full_name_override IS NULL OR NEW.informal_full_name_override = '')
|
||||
THEN
|
||||
SET NEW.informal_full_name_override = name_for_informal_display_name(NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
END IF;
|
||||
*/
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_person` BEFORE UPDATE ON `person` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_person_names` BEFORE UPDATE ON `person` FOR EACH ROW BEGIN
|
||||
SET NEW.full_name = name_for_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
SET NEW.last_first_name = name_for_last_first_name(NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
|
||||
SET NEW.informal_full_name = name_for_informal_full_name(NEW.informal_name, NEW.title_names, NEW.given_name, NEW.middle_name, NEW.family_name, NEW.designations);
|
||||
|
||||
/*
|
||||
IF (NEW.full_name_override IS NULL OR NEW.full_name_override = '')
|
||||
THEN
|
||||
SET NEW.full_name_override = name_for_display_name(NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
END IF;
|
||||
*/
|
||||
|
||||
/*
|
||||
IF (NEW.informal_full_name_override IS NULL OR NEW.informal_full_name_override = '')
|
||||
THEN
|
||||
SET NEW.informal_full_name_override = name_for_informal_display_name(NEW.informal_name, NEW.given_name, NEW.middle_name, NEW.family_name);
|
||||
END IF;
|
||||
*/
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `person_after_delete` AFTER DELETE ON `person` FOR EACH ROW BEGIN
|
||||
DELETE FROM user WHERE user.id = old.user_id;
|
||||
DELETE FROM contact WHERE contact.for_id = old.id AND contact.for_type = 'person';
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `person`
|
||||
--
|
||||
ALTER TABLE `person`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `user_id` (`user_id`),
|
||||
ADD KEY `organization_id` (`organization_id`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `external_id` (`external_sys_id`),
|
||||
ADD KEY `family_name` (`family_name`),
|
||||
ADD KEY `given_name` (`given_name`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `priority` (`priority`),
|
||||
ADD KEY `sort` (`sort`),
|
||||
ADD KEY `group` (`group`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `person`
|
||||
--
|
||||
ALTER TABLE `person`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,128 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:22 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `site`
|
||||
--
|
||||
|
||||
CREATE TABLE `site` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`code` varchar(100) DEFAULT NULL,
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`restrict_access` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`access_key` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`access_code_kv_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'for super, manager, administrator, trusted, public, authenticated' CHECK (json_valid(`access_code_kv_json`)),
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_from` datetime DEFAULT NULL,
|
||||
`enable_to` datetime DEFAULT NULL,
|
||||
`logo_path` varchar(200) DEFAULT NULL,
|
||||
`logo_bg_color` varchar(25) DEFAULT NULL,
|
||||
`background_image_path` varchar(200) DEFAULT NULL,
|
||||
`background_bg_color` varchar(25) DEFAULT NULL,
|
||||
`site_menu_html_path` varchar(200) DEFAULT NULL COMMENT 'path to html file for site menu',
|
||||
`site_menu` text DEFAULT NULL COMMENT 'not currently used; but want to use',
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`header_html` text DEFAULT NULL,
|
||||
`header_css` text DEFAULT NULL,
|
||||
`header_image_path` varchar(200) DEFAULT NULL,
|
||||
`header_image_bg_color` varchar(25) DEFAULT NULL,
|
||||
`body_html` text DEFAULT NULL,
|
||||
`tagline` text DEFAULT NULL COMMENT 'catchphrase or slogan',
|
||||
`site_header_h1` text DEFAULT NULL COMMENT 'field not currently used',
|
||||
`site_header_h2` text DEFAULT NULL COMMENT 'field not currently used',
|
||||
`style_href` varchar(200) DEFAULT NULL,
|
||||
`script_src` varchar(200) DEFAULT NULL,
|
||||
`google_tracking_id` varchar(14) DEFAULT NULL,
|
||||
`cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{}' COMMENT 'config in JSON format' CHECK (json_valid(`cfg_json`)),
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`notes` text DEFAULT NULL,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `site`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_site` BEFORE INSERT ON `site` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_site` BEFORE UPDATE ON `site` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `site`
|
||||
--
|
||||
ALTER TABLE `site`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `access_key` (`access_key`),
|
||||
ADD KEY `name` (`name`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `site`
|
||||
--
|
||||
ALTER TABLE `site`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,104 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:22 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `site_domain`
|
||||
--
|
||||
|
||||
CREATE TABLE `site_domain` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`site_id` int(11) NOT NULL,
|
||||
`fqdn` varchar(200) NOT NULL,
|
||||
`access_key` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`required_referrer` varchar(200) DEFAULT NULL,
|
||||
`valid_for` int(11) DEFAULT NULL COMMENT 'number of hours to allow before checking again',
|
||||
`enable` tinyint(1) DEFAULT 1,
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Triggers `site_domain`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_site_domain` BEFORE INSERT ON `site_domain` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_site_domain` BEFORE UPDATE ON `site_domain` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `site_domain`
|
||||
--
|
||||
ALTER TABLE `site_domain`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `fqdn` (`fqdn`),
|
||||
ADD KEY `access_key` (`access_key`),
|
||||
ADD KEY `required_referrer` (`required_referrer`),
|
||||
ADD KEY `site_id` (`site_id`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `site_domain`
|
||||
--
|
||||
ALTER TABLE `site_domain`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,163 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.3
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jan 06, 2026 at 06:23 PM
|
||||
-- Server version: 12.1.2-MariaDB-log
|
||||
-- PHP Version: 8.4.15
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `aether_dev`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `user`
|
||||
--
|
||||
|
||||
CREATE TABLE `user` (
|
||||
`id` int(11) NOT NULL,
|
||||
`id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT 'NULL',
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`contact_id` int(11) DEFAULT NULL COMMENT 'no longer going to be used',
|
||||
`organization_id` int(11) DEFAULT NULL COMMENT 'no longer going to be used',
|
||||
`person_id` int(11) DEFAULT NULL COMMENT 'no longer going to be used',
|
||||
`username` varchar(100) NOT NULL,
|
||||
`name` varchar(100) DEFAULT NULL,
|
||||
`email` varchar(254) NOT NULL,
|
||||
`email_verified` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`password` varchar(100) DEFAULT NULL,
|
||||
`allow_auth_key` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'allow use of auth key to sign in',
|
||||
`auth_key` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'auth key for single use log in',
|
||||
`enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`enable_from` datetime DEFAULT current_timestamp(),
|
||||
`enable_to` datetime DEFAULT NULL,
|
||||
`super` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Super user for the entire system. Can do everything.',
|
||||
`manager` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Manager for the entire system. Can do almost everything.',
|
||||
`administrator` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Administrator for a client account. Can do almost anything within that account.',
|
||||
`public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'public or shared account',
|
||||
`verified` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is this a verified user account?',
|
||||
`level` int(11) DEFAULT NULL COMMENT 'access level (1 to 5)',
|
||||
`status_id` int(11) DEFAULT NULL COMMENT 'offline, away, dnd, online',
|
||||
`password_set_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`password_reset_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`password_reset_expire_on` datetime DEFAULT NULL,
|
||||
`logged_in_on` timestamp NULL DEFAULT NULL,
|
||||
`last_activity_on` timestamp NULL DEFAULT NULL,
|
||||
`hide` tinyint(1) DEFAULT NULL,
|
||||
`priority` tinyint(1) DEFAULT NULL,
|
||||
`sort` int(11) DEFAULT NULL COMMENT 'used as access level',
|
||||
`group` varchar(100) DEFAULT NULL COMMENT 'used as access group',
|
||||
`notes` text DEFAULT NULL,
|
||||
`other_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`other_json`)),
|
||||
`created_on` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The user account.';
|
||||
|
||||
--
|
||||
-- Triggers `user`
|
||||
--
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `after_insert_user_person_id` AFTER INSERT ON `user` FOR EACH ROW BEGIN
|
||||
IF (NEW.person_id IS NOT NULL)
|
||||
THEN
|
||||
UPDATE person SET person.user_id = NEW.id WHERE person.id = NEW.person_id AND person.user_id IS NULL;
|
||||
END IF;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `after_update_user_person_id` AFTER UPDATE ON `user` FOR EACH ROW BEGIN
|
||||
IF (NEW.person_id IS NOT NULL AND OLD.person_id IS NULL)
|
||||
THEN
|
||||
UPDATE person SET person.user_id = NEW.id WHERE person.id = NEW.person_id AND person.user_id IS NULL;
|
||||
END IF;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_insert_user` BEFORE INSERT ON `user` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_user` BEFORE UPDATE ON `user` FOR EACH ROW BEGIN
|
||||
BEGIN
|
||||
IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
|
||||
THEN
|
||||
/* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
|
||||
/* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
|
||||
SET NEW.id_random = gen_rand_str(11, 'URL');
|
||||
END IF;
|
||||
END;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `before_update_user_email` BEFORE UPDATE ON `user` FOR EACH ROW BEGIN
|
||||
IF (NEW.username IS NULL OR NEW.username = '')
|
||||
THEN
|
||||
SET NEW.username = NEW.email;
|
||||
SET NEW.notes = CONCAT(COALESCE(`NEW`.`notes`,''), ';;sys::overide empty username');
|
||||
END IF;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER `update_password_set_on` BEFORE UPDATE ON `user` FOR EACH ROW IF NEW.password <> OLD.password THEN SET NEW.password_set_on = CURRENT_TIMESTAMP; END IF
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `user`
|
||||
--
|
||||
ALTER TABLE `user`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `id_random` (`id_random`),
|
||||
ADD KEY `username` (`username`) USING BTREE,
|
||||
ADD KEY `account_id` (`account_id`),
|
||||
ADD KEY `email` (`email`),
|
||||
ADD KEY `email_2` (`email`),
|
||||
ADD KEY `created_on` (`created_on`),
|
||||
ADD KEY `updated_on` (`updated_on`),
|
||||
ADD KEY `enable` (`enable`),
|
||||
ADD KEY `name` (`name`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `user`
|
||||
--
|
||||
ALTER TABLE `user`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -53,7 +53,8 @@ export interface Site_Domain {
|
||||
site_id: string;
|
||||
site_id_random: string;
|
||||
|
||||
domain: string;
|
||||
fqdn: string;
|
||||
access_key?: null | string;
|
||||
|
||||
enable: null | boolean;
|
||||
enable_from?: null | Date;
|
||||
@@ -557,7 +558,8 @@ const properties_to_save__site_domain = [
|
||||
'site_domain_id_random',
|
||||
'site_id',
|
||||
'site_id_random',
|
||||
'domain',
|
||||
'fqdn',
|
||||
'access_key',
|
||||
'enable',
|
||||
'enable_from',
|
||||
'enable_to',
|
||||
@@ -605,7 +607,7 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const priority = processed_obj.priority ? 1 : 0;
|
||||
const sort = processed_obj.sort ?? '0';
|
||||
const updated = processed_obj.updated_on ?? processed_obj.created_on;
|
||||
const name = processed_obj.name ?? processed_obj.domain ?? '';
|
||||
const name = processed_obj.name ?? processed_obj.fqdn ?? '';
|
||||
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
|
||||
19
src/lib/ae_core/ae_core__user.editable_fields.ts
Normal file
19
src/lib/ae_core/ae_core__user.editable_fields.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export const editable_fields__user = [
|
||||
'username',
|
||||
'name',
|
||||
'email',
|
||||
'allow_auth_key',
|
||||
'super',
|
||||
'manager',
|
||||
'administrator',
|
||||
'verified',
|
||||
'public',
|
||||
'enable',
|
||||
'enable_from',
|
||||
'enable_to',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes'
|
||||
];
|
||||
379
src/lib/ae_core/ae_core__user.ts
Normal file
379
src/lib/ae_core/ae_core__user.ts
Normal file
@@ -0,0 +1,379 @@
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { api } from '$lib/api/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||
import { db_core } from '$lib/ae_core/db_core';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
user_id: string;
|
||||
user_id_random: string;
|
||||
|
||||
username: string;
|
||||
name: string;
|
||||
email: string;
|
||||
|
||||
allow_auth_key: boolean;
|
||||
super: boolean;
|
||||
manager: boolean;
|
||||
administrator: boolean;
|
||||
verified: boolean;
|
||||
public: boolean;
|
||||
|
||||
person_id?: string;
|
||||
person_id_random?: string;
|
||||
|
||||
enable: null | boolean;
|
||||
enable_from?: null | Date;
|
||||
enable_to?: null | Date;
|
||||
|
||||
hide?: null | boolean;
|
||||
priority?: null | boolean;
|
||||
sort?: null | number;
|
||||
group?: null | string;
|
||||
notes?: null | string;
|
||||
created_on: Date;
|
||||
updated_on?: null | Date;
|
||||
|
||||
tmp_sort_1?: string;
|
||||
tmp_sort_2?: string;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function load_ae_obj_id__user({
|
||||
api_cfg,
|
||||
user_id,
|
||||
view = 'default',
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
user_id: string;
|
||||
view?: string;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__user() *** user_id=${user_id}`);
|
||||
}
|
||||
|
||||
ae_promises.load__user_obj = await api
|
||||
.get_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
obj_id: user_id,
|
||||
view,
|
||||
params,
|
||||
log_lvl
|
||||
})
|
||||
.then(async function (result) {
|
||||
if (result) {
|
||||
if (try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__user_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_core,
|
||||
table_name: 'user',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
return ae_promises.load__user_obj;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function load_ae_obj_li__user({
|
||||
api_cfg,
|
||||
qry_str = null,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
view = 'default',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = { username: 'ASC' },
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
qry_str?: string | null;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled';
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden';
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
let promise;
|
||||
|
||||
if (qry_str) {
|
||||
const search_query: any = { q: qry_str };
|
||||
promise = api.search_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
search_query,
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
log_lvl
|
||||
});
|
||||
} else {
|
||||
promise = api.get_ae_obj_li_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
ae_promises.load__user_obj_li = await promise.then(async function (result_li) {
|
||||
if (result_li) {
|
||||
if (try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__user_props({
|
||||
obj_li: result_li,
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_core,
|
||||
table_name: 'user',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return result_li;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
return ae_promises.load__user_obj_li;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function create_ae_obj__user({
|
||||
api_cfg,
|
||||
data_kv,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
data_kv: key_val;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.create_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
fields: data_kv,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result && try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__user_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_core,
|
||||
table_name: 'user',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function update_ae_obj__user({
|
||||
api_cfg,
|
||||
user_id,
|
||||
data_kv,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
user_id: string;
|
||||
data_kv: key_val;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
obj_id: user_id,
|
||||
fields: data_kv,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result && try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__user_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_core,
|
||||
table_name: 'user',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function delete_ae_obj_id__user({
|
||||
api_cfg,
|
||||
user_id,
|
||||
method = 'delete',
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
user_id: string;
|
||||
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'user',
|
||||
obj_id: user_id,
|
||||
method,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (try_cache) {
|
||||
await db_core.user.delete(user_id);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const properties_to_save = [
|
||||
'id',
|
||||
'user_id',
|
||||
'user_id_random',
|
||||
'username',
|
||||
'name',
|
||||
'email',
|
||||
'allow_auth_key',
|
||||
'super',
|
||||
'manager',
|
||||
'administrator',
|
||||
'verified',
|
||||
'public',
|
||||
'person_id',
|
||||
'person_id_random',
|
||||
'enable',
|
||||
'enable_from',
|
||||
'enable_to',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2'
|
||||
];
|
||||
|
||||
async function _process_generic_props<T extends Record<string, any>>({
|
||||
obj_li,
|
||||
obj_type,
|
||||
log_lvl = 0,
|
||||
specific_processor
|
||||
}: {
|
||||
obj_li: T[];
|
||||
obj_type: string;
|
||||
log_lvl?: number;
|
||||
specific_processor?: (obj: T) => Promise<T> | T;
|
||||
}): Promise<T[]> {
|
||||
if (!obj_li || obj_li.length === 0) return [];
|
||||
|
||||
const processed_obj_li: T[] = [];
|
||||
|
||||
for (const original_obj of obj_li) {
|
||||
let processed_obj = { ...original_obj };
|
||||
|
||||
for (const key in processed_obj) {
|
||||
if (key.endsWith('_random')) {
|
||||
const newKey = key.slice(0, -7);
|
||||
(processed_obj as any)[newKey] = processed_obj[key];
|
||||
}
|
||||
}
|
||||
const randomIdKey = `${obj_type}_id_random`;
|
||||
if (processed_obj[randomIdKey]) {
|
||||
(processed_obj as any).id = processed_obj[randomIdKey];
|
||||
}
|
||||
|
||||
const group = processed_obj.group ?? '0';
|
||||
const priority = processed_obj.priority ? 1 : 0;
|
||||
const sort = processed_obj.sort ?? '0';
|
||||
const updated = processed_obj.updated_on ?? processed_obj.created_on;
|
||||
const name = processed_obj.username ?? processed_obj.name ?? '';
|
||||
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
|
||||
if (specific_processor) {
|
||||
processed_obj = await Promise.resolve(specific_processor(processed_obj));
|
||||
}
|
||||
|
||||
processed_obj_li.push(processed_obj as T);
|
||||
}
|
||||
|
||||
return processed_obj_li;
|
||||
}
|
||||
|
||||
export async function process_ae_obj__user_props({
|
||||
obj_li,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
obj_li: any[];
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
return _process_generic_props({
|
||||
obj_li,
|
||||
obj_type: 'user',
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
@@ -132,14 +132,47 @@ export interface Person {
|
||||
address_country_alpha_2_code?: null | string; // ISO 3166-1 alpha-2 country code
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export interface User {
|
||||
id: string;
|
||||
user_id: string;
|
||||
user_id_random: string;
|
||||
|
||||
username: string;
|
||||
name: string;
|
||||
email: string;
|
||||
|
||||
allow_auth_key: boolean;
|
||||
super: boolean;
|
||||
manager: boolean;
|
||||
administrator: boolean;
|
||||
verified: boolean;
|
||||
public: boolean;
|
||||
|
||||
person_id?: string;
|
||||
person_id_random?: string;
|
||||
|
||||
enable: null | boolean;
|
||||
hide?: null | boolean;
|
||||
priority?: null | boolean;
|
||||
sort?: null | number;
|
||||
group?: null | string;
|
||||
notes?: null | string;
|
||||
created_on: Date;
|
||||
updated_on?: null | Date;
|
||||
|
||||
tmp_sort_1?: string;
|
||||
tmp_sort_2?: string;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export class MySubClassedDexie extends Dexie {
|
||||
file!: Table<File>;
|
||||
person!: Table<Person>;
|
||||
user!: Table<User>;
|
||||
account!: Table<any>;
|
||||
site!: Table<any>;
|
||||
site_domain!: Table<any>;
|
||||
// user!: Table<User>;
|
||||
|
||||
constructor() {
|
||||
super('ae_core_db');
|
||||
@@ -165,6 +198,12 @@ export class MySubClassedDexie extends Dexie {
|
||||
agree,
|
||||
enable, hide, priority, sort, group, created_on, updated_on`,
|
||||
|
||||
user: `
|
||||
id, user_id, user_id_random,
|
||||
username, name, email,
|
||||
super, manager, administrator,
|
||||
enable, hide, priority, sort, group, created_on, updated_on`,
|
||||
|
||||
account: `
|
||||
id, account_id, account_id_random,
|
||||
code, name,
|
||||
|
||||
46
src/lib/ae_events/ae_events__event_badge.editable_fields.ts
Normal file
46
src/lib/ae_events/ae_events__event_badge.editable_fields.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
export const editable_fields__event_badge = [
|
||||
'event_badge_template_id',
|
||||
'event_badge_template_id_random',
|
||||
'pronouns',
|
||||
'informal_name',
|
||||
'title_names',
|
||||
'given_name',
|
||||
'middle_name',
|
||||
'family_name',
|
||||
'designations',
|
||||
'professional_title',
|
||||
'professional_title_override',
|
||||
'full_name_override',
|
||||
'affiliations',
|
||||
'affiliations_override',
|
||||
'email',
|
||||
'email_override',
|
||||
'address_line_1',
|
||||
'address_line_2',
|
||||
'address_line_3',
|
||||
'city',
|
||||
'country_subdivision_code',
|
||||
'state_province',
|
||||
'state_province_abb',
|
||||
'postal_code',
|
||||
'country_alpha_2_code',
|
||||
'country',
|
||||
'location_override',
|
||||
'badge_type',
|
||||
'badge_type_code',
|
||||
'badge_type_override',
|
||||
'badge_type_code_override',
|
||||
'external_event_id',
|
||||
'external_id',
|
||||
'external_person_id',
|
||||
'alert',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'print_count',
|
||||
'print_first_datetime',
|
||||
'print_last_datetime'
|
||||
];
|
||||
@@ -121,7 +121,7 @@ export async function load_ae_obj_li__event_badge({
|
||||
|
||||
ae_promises.load__event_badge_obj_li = await api
|
||||
.get_ae_obj_li_v3({
|
||||
api_cfg: api_cfg,
|
||||
api_cfg,
|
||||
obj_type: 'event_badge',
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
@@ -182,7 +182,7 @@ export async function load_ae_obj_li__event_badge({
|
||||
return ae_promises.load__event_badge_obj_li;
|
||||
}
|
||||
|
||||
// Updated 2025-10-06
|
||||
// Updated 2026-01-06
|
||||
export async function create_ae_obj__event_badge({
|
||||
api_cfg,
|
||||
event_id,
|
||||
@@ -201,49 +201,39 @@ export async function create_ae_obj__event_badge({
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`);
|
||||
}
|
||||
ae_promises.create__event_badge = await api
|
||||
.create_ae_obj_crud({
|
||||
api_cfg,
|
||||
obj_type: 'event_badge',
|
||||
fields: {
|
||||
event_id_random: event_id,
|
||||
...data_kv
|
||||
},
|
||||
key: api_cfg.api_crud_super_key,
|
||||
params,
|
||||
return_obj: true,
|
||||
|
||||
const result = await api.create_nested_obj_v3({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
child_type: 'event_badge',
|
||||
fields: data_kv,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result && try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__event_badge_props({
|
||||
obj_li: [result],
|
||||
event_id,
|
||||
log_lvl
|
||||
})
|
||||
.then(async function (event_badge_obj_create_result) {
|
||||
if (event_badge_obj_create_result) {
|
||||
if (try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__event_badge_props({
|
||||
obj_li: [event_badge_obj_create_result],
|
||||
event_id,
|
||||
log_lvl
|
||||
});
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'badge',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return event_badge_obj_create_result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
return ae_promises.create__event_badge;
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'badge',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2025-10-06
|
||||
// Updated 2026-01-06
|
||||
export async function delete_ae_obj_id__event_badge({
|
||||
api_cfg,
|
||||
event_id,
|
||||
event_badge_id,
|
||||
method = 'delete',
|
||||
params = {},
|
||||
@@ -251,8 +241,9 @@ export async function delete_ae_obj_id__event_badge({
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
event_badge_id: string;
|
||||
method?: string;
|
||||
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
@@ -260,35 +251,29 @@ export async function delete_ae_obj_id__event_badge({
|
||||
if (log_lvl) {
|
||||
console.log(`*** delete_ae_obj_id__event_badge() *** event_badge_id=${event_badge_id}`);
|
||||
}
|
||||
ae_promises.delete__event_badge_obj = await api
|
||||
.delete_ae_obj_id_crud({
|
||||
api_cfg,
|
||||
obj_type: 'event_badge',
|
||||
obj_id: event_badge_id,
|
||||
key: api_cfg.api_crud_super_key,
|
||||
params,
|
||||
method,
|
||||
log_lvl
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
if (try_cache) {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`Attempting to remove IDB entry for event_badge_id=${event_badge_id}`
|
||||
);
|
||||
}
|
||||
db_events.badge.delete(event_badge_id);
|
||||
}
|
||||
});
|
||||
return ae_promises.delete__event_badge_obj;
|
||||
|
||||
const result = await api.delete_nested_ae_obj_v3({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
child_type: 'event_badge',
|
||||
child_id: event_badge_id,
|
||||
method,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (try_cache) {
|
||||
await db_events.badge.delete(event_badge_id);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2025-10-06
|
||||
// Updated 2026-01-06
|
||||
export async function update_ae_obj__event_badge({
|
||||
api_cfg,
|
||||
event_id,
|
||||
event_badge_id,
|
||||
data_kv,
|
||||
params = {},
|
||||
@@ -296,6 +281,7 @@ export async function update_ae_obj__event_badge({
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
event_badge_id: string;
|
||||
data_kv: key_val;
|
||||
params?: key_val;
|
||||
@@ -305,41 +291,34 @@ export async function update_ae_obj__event_badge({
|
||||
if (log_lvl) {
|
||||
console.log(`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`);
|
||||
}
|
||||
ae_promises.update__event_badge_obj = await api
|
||||
.update_ae_obj_id_crud({
|
||||
api_cfg,
|
||||
obj_type: 'event_badge',
|
||||
obj_id: event_badge_id,
|
||||
fields: data_kv,
|
||||
key: api_cfg.api_crud_super_key,
|
||||
params,
|
||||
return_obj: true,
|
||||
|
||||
const result = await api.update_nested_obj_v3({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
child_type: 'event_badge',
|
||||
child_id: event_badge_id,
|
||||
fields: data_kv,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result && try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__event_badge_props({
|
||||
obj_li: [result],
|
||||
event_id,
|
||||
log_lvl
|
||||
})
|
||||
.then(async function (event_badge_obj_update_result) {
|
||||
if (event_badge_obj_update_result) {
|
||||
if (try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__event_badge_props({
|
||||
obj_li: [event_badge_obj_update_result],
|
||||
log_lvl
|
||||
});
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'badge',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return event_badge_obj_update_result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
return ae_promises.update__event_badge_obj;
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'badge',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Is this needed?
|
||||
@@ -751,4 +730,4 @@ export async function process_ae_obj__event_badge_props({
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
// import { liveQuery } from "dexie";
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { Building, Globe, Users, ShieldCheck, List, Plus } from 'lucide-svelte';
|
||||
// import { db_core } from "$lib/db_core";
|
||||
// import { db_events } from "$lib/db_events";
|
||||
import {
|
||||
@@ -45,128 +46,127 @@
|
||||
// let search_submit_results: Promise<any>|key_val;
|
||||
</script>
|
||||
|
||||
<section class="ae_core md:container mx-auto">
|
||||
<h2 class="h3">Æ Core for {$ae_loc.account_name ?? 'Æ loading...'}</h2>
|
||||
<section class="ae_core md:container mx-auto p-4 space-y-6">
|
||||
<header class="flex justify-between items-center border-b border-surface-500/30 pb-4">
|
||||
<h2 class="h2">Æ Core Management</h2>
|
||||
<div class="text-right">
|
||||
<p class="text-sm opacity-60">Active Account</p>
|
||||
<p class="font-bold">{$ae_loc.account_name ?? 'Loading...'}</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
console.log('Edit the POC person for the session.');
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<!-- Account Management Card -->
|
||||
<div class="card p-4 space-y-4 variant-soft-primary">
|
||||
<div class="flex items-center gap-2">
|
||||
<Building size={20} />
|
||||
<h3 class="h4">Accounts</h3>
|
||||
</div>
|
||||
<p class="text-sm opacity-80 text-balance">Manage client accounts and high-level system settings.</p>
|
||||
<button class="btn variant-filled-primary w-full" onclick={() => goto('/core/accounts')}>
|
||||
Manage Accounts
|
||||
</button>
|
||||
</div>
|
||||
|
||||
// let params = {
|
||||
// qry__limit: $ae_loc.person.qry_limit__people,
|
||||
// }
|
||||
<!-- Site Management Card -->
|
||||
<div class="card p-4 space-y-4 variant-soft-secondary">
|
||||
<div class="flex items-center gap-2">
|
||||
<Globe size={20} />
|
||||
<h3 class="h4">Sites</h3>
|
||||
</div>
|
||||
<p class="text-sm opacity-80 text-balance">Configure sites and domains associated with the active account.</p>
|
||||
<button class="btn variant-filled-secondary w-full" onclick={() => goto('/core/sites')}>
|
||||
Manage Sites
|
||||
</button>
|
||||
</div>
|
||||
|
||||
// $slct.person_obj_li = await core_func.load_ae_obj_li__person({api_cfg: $ae_api, account_id: $slct.account_id, params: params});
|
||||
<!-- User Management Card -->
|
||||
<div class="card p-4 space-y-4 variant-soft-error">
|
||||
<div class="flex items-center gap-2">
|
||||
<ShieldCheck size={20} />
|
||||
<h3 class="h4">Users</h3>
|
||||
</div>
|
||||
<p class="text-sm opacity-80 text-balance">Manage system access, permissions, and user credentials.</p>
|
||||
<button class="btn variant-filled-error w-full" onclick={() => goto('/core/users')}>
|
||||
Manage Users
|
||||
</button>
|
||||
</div>
|
||||
|
||||
let person_results = core_func
|
||||
.load_ae_obj_li__person({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $slct.account_id,
|
||||
limit: $ae_loc.person.qry_limit__people,
|
||||
// params: params,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (load_results) {
|
||||
console.log(`Loaded person_obj_li:`, load_results);
|
||||
|
||||
// We need to make this ready for the select option list. Convert the list to a key value pair with the person_id_random as the key. We also need to set the option text value to: full_name (primary_email)
|
||||
if (load_results) {
|
||||
$slct.person_id_random_li = load_results;
|
||||
|
||||
person_id_random_li = [];
|
||||
|
||||
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
|
||||
for (let i = 0; i < $slct.person_id_random_li.length; i++) {
|
||||
let person_obj = $slct.person_id_random_li[i];
|
||||
let person_id_random = person_obj.person_id_random;
|
||||
tmp_li.push(person_id_random);
|
||||
<!-- Person Management Card -->
|
||||
<div class="card p-4 space-y-4 variant-soft-warning">
|
||||
<div class="flex items-center gap-2">
|
||||
<Users size={20} />
|
||||
<h3 class="h4">People</h3>
|
||||
</div>
|
||||
<p class="text-sm opacity-80 text-balance">View and manage person records and their associated user accounts.</p>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
let person_results = core_func
|
||||
.load_ae_obj_li__person({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $slct.account_id,
|
||||
limit: $ae_loc.person.qry_limit__people,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (load_results) {
|
||||
if (load_results) {
|
||||
$slct.person_id_random_li = load_results;
|
||||
person_id_random_li = load_results.map((p: any) => p.person_id_random);
|
||||
}
|
||||
return load_results;
|
||||
})
|
||||
.finally(() => {
|
||||
$ae_sess.person.show_report__person_li = true;
|
||||
});
|
||||
}}
|
||||
class="btn variant-filled-warning flex-1"
|
||||
>
|
||||
List People
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick={async () => {
|
||||
if (!confirm(`Add a new person to ${$ae_loc.account_name}?`)) return;
|
||||
let person_data = {
|
||||
account_id_random: $slct.account_id,
|
||||
source_code: 'manual:SK-core',
|
||||
given_name: 'New',
|
||||
family_name: 'Person',
|
||||
enable: true
|
||||
};
|
||||
let new_person_obj = await core_func.create_ae_obj__person({
|
||||
api_cfg: $ae_api,
|
||||
data_kv: person_data,
|
||||
log_lvl: 1
|
||||
});
|
||||
if (new_person_obj && confirm(`Person created. View details?`)) {
|
||||
goto(`/core/person/${new_person_obj.person_id_random}`);
|
||||
}
|
||||
person_id_random_li = tmp_li;
|
||||
}}
|
||||
class="btn variant-filled-warning btn-icon"
|
||||
class:hidden={!$ae_loc.edit_mode}
|
||||
>
|
||||
<Plus size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// $slct.person_id_random_li = load_results.map((person_obj) => person_obj.person_id_random);
|
||||
// let person_obj_li = load_results;
|
||||
// let person_obj_kv = {};
|
||||
// person_obj_kv[''] = '-- Select a person --';
|
||||
// person_obj_li.forEach((person_obj) => {
|
||||
// let option_text = `${person_obj.full_name} (${person_obj.primary_email})`;
|
||||
// person_obj_kv[person_obj.person_id_random] = option_text;
|
||||
// });
|
||||
// $slct.person_obj_kv = person_obj_kv;
|
||||
}
|
||||
// $slct.person_obj_kv = $slct.person_obj_kv;
|
||||
// console.log(`$slct.person_obj_kv = `, $slct.person_obj_kv);
|
||||
<!-- Lookups Card -->
|
||||
<div class="card p-4 space-y-4 variant-soft-surface">
|
||||
<div class="flex items-center gap-2">
|
||||
<List size={20} />
|
||||
<h3 class="h4">Lookups</h3>
|
||||
</div>
|
||||
<p class="text-sm opacity-80 text-balance">View system lookup tables (countries, time zones, etc).</p>
|
||||
<button class="btn variant-filled-surface w-full" onclick={() => goto('/core/lookups')}>
|
||||
View Lookups
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
return load_results;
|
||||
})
|
||||
.finally(() => {
|
||||
console.log(`person_id_random_li:`, person_id_random_li);
|
||||
$ae_sess.person.show_report__person_li = true;
|
||||
});
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-warning hover:preset-tonal-warning border border-warning-500"
|
||||
>
|
||||
<span class="fas fa-user mx-1"></span>
|
||||
List People
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={async () => {
|
||||
console.log('Add Person');
|
||||
if (
|
||||
!confirm(
|
||||
`Add a new person to the account?\n${$ae_loc.account_name}\nID: ${$slct.account_id}`
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
let person_data = {
|
||||
account_id_random: $slct.account_id,
|
||||
// user_id_random: user_obj.user_id_random,
|
||||
source_code: 'manual:SK-core',
|
||||
given_name: 'New',
|
||||
family_name: 'Person',
|
||||
// professional_title: 'Temp Prof Title',
|
||||
// affiliations: 'Temp Org',
|
||||
// primary_email: 'tmp+person@oneskyit.com',
|
||||
// allow_auth_key: false,
|
||||
auth_key: Math.floor(Math.random() * 90000000) + 10000000,
|
||||
// Random number between 100000 and 999999
|
||||
passcode: Math.floor(Math.random() * 900000) + 100000,
|
||||
enable: true
|
||||
};
|
||||
|
||||
let new_person_obj = await core_func.create_ae_obj__person({
|
||||
api_cfg: $ae_api,
|
||||
// user_id: $ae_loc.user_id,
|
||||
data_kv: person_data,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
console.log('new_person_obj:', new_person_obj);
|
||||
|
||||
if (
|
||||
confirm(
|
||||
`Person created:\n${new_person_obj.full_name} (${new_person_obj.primary_email ?? 'no email'})\nID: ${new_person_obj.person_id_random}\n\nView this person?`
|
||||
)
|
||||
) {
|
||||
// window.location.reload();
|
||||
// invalidateAll();
|
||||
goto(`/core/person/${new_person_obj.person_id_random}`, { replaceState: true });
|
||||
// pushState(`/core/person/${new_person_obj.person_id_random}`, { replace: true });
|
||||
// replaceState(`/core/person/${new_person_obj.person_id_random}`);
|
||||
}
|
||||
}}
|
||||
class:hidden={!$ae_loc.edit_mode}
|
||||
class="btn btn-sm preset-tonal-warning hover:preset-filled-warning-500"
|
||||
>
|
||||
<span class="fas fa-plus mx-1"></span>
|
||||
Add Person
|
||||
</button>
|
||||
|
||||
<!-- Show people for this account -->
|
||||
{#if $ae_sess.person.show_report__person_li && person_id_random_li?.length > 0}
|
||||
|
||||
130
src/routes/core/accounts/+page.svelte
Normal file
130
src/routes/core/accounts/+page.svelte
Normal file
@@ -0,0 +1,130 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { load_ae_obj_li__account, create_ae_obj__account } from '$lib/ae_core/ae_core__account';
|
||||
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { FileText, Plus, Search, Building } from 'lucide-svelte';
|
||||
|
||||
let account_li: any[] = $state([]);
|
||||
let loading = $state(true);
|
||||
let qry_enabled = $state('all');
|
||||
let qry_hidden = $state('all');
|
||||
|
||||
async function load_accounts() {
|
||||
loading = true;
|
||||
account_li = await load_ae_obj_li__account({
|
||||
api_cfg: $ae_api,
|
||||
enabled: qry_enabled as any,
|
||||
hidden: qry_hidden as any,
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
load_accounts();
|
||||
});
|
||||
|
||||
async function handle_add_account() {
|
||||
const name = prompt('Enter new account name:');
|
||||
if (!name) return;
|
||||
|
||||
const code = prompt('Enter account code (optional):');
|
||||
|
||||
const new_acct = await create_ae_obj__account({
|
||||
api_cfg: $ae_api,
|
||||
data_kv: {
|
||||
name,
|
||||
code: code || undefined,
|
||||
enable: true
|
||||
},
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if (new_acct) {
|
||||
load_accounts();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-4">
|
||||
<header class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-2">
|
||||
<Building size={24} />
|
||||
<h1 class="h2">Account Management</h1>
|
||||
</div>
|
||||
<button class="btn variant-filled-primary" onclick={handle_add_account}>
|
||||
<Plus size={16} class="mr-2" /> Add Account
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="card p-4 variant-soft flex flex-wrap gap-4 items-end">
|
||||
<label class="label">
|
||||
<span>Enabled Status</span>
|
||||
<select class="select" bind:value={qry_enabled} onchange={load_accounts}>
|
||||
<option value="all">All</option>
|
||||
<option value="enabled">Enabled Only</option>
|
||||
<option value="not_enabled">Disabled Only</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Hidden Status</span>
|
||||
<select class="select" bind:value={qry_hidden} onchange={load_accounts}>
|
||||
<option value="all">All</option>
|
||||
<option value="not_hidden">Not Hidden Only</option>
|
||||
<option value="hidden">Hidden Only</option>
|
||||
</select>
|
||||
</label>
|
||||
<button class="btn variant-filled-secondary" onclick={load_accounts} disabled={loading}>
|
||||
<Search size={16} class="mr-2" /> Refresh
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if loading}
|
||||
<div class="flex justify-center p-12">
|
||||
<div class="placeholder animate-pulse w-full h-32"></div>
|
||||
</div>
|
||||
{:else if account_li.length === 0}
|
||||
<div class="card p-8 text-center">
|
||||
<p>No accounts found matching your filters.</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="table-container">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Code</th>
|
||||
<th>Created</th>
|
||||
<th>Status</th>
|
||||
<th class="text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each account_li as acct}
|
||||
<tr>
|
||||
<td>{acct.name}</td>
|
||||
<td><code class="code">{acct.code || '--'}</code></td>
|
||||
<td>{new Date(acct.created_on).toLocaleDateString()}</td>
|
||||
<td>
|
||||
{#if acct.enable}
|
||||
<span class="badge variant-filled-success">Enabled</span>
|
||||
{:else}
|
||||
<span class="badge variant-filled-error">Disabled</span>
|
||||
{/if}
|
||||
{#if acct.hide}
|
||||
<span class="badge variant-filled-warning">Hidden</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-sm variant-soft-primary" onclick={() => goto(`/core/accounts/${acct.account_id_random}`)}>
|
||||
Manage
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
14
src/routes/core/accounts/+page.ts
Normal file
14
src/routes/core/accounts/+page.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { PageLoad } from './$types';
|
||||
import { load_ae_obj_li__account } from '$lib/ae_core/ae_core__account';
|
||||
import { get } from 'svelte/store';
|
||||
import { ae_api } from '$lib/stores/ae_stores';
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
// Ensure we have parent data if needed, but for listing accounts we mostly need the api_cfg
|
||||
const parentData = await parent();
|
||||
|
||||
return {
|
||||
// We could pre-load here, but listing accounts might be better handled in the component
|
||||
// to support interactive filtering/pagination more easily.
|
||||
};
|
||||
};
|
||||
149
src/routes/core/accounts/[account_id]/+page.svelte
Normal file
149
src/routes/core/accounts/[account_id]/+page.svelte
Normal file
@@ -0,0 +1,149 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { load_ae_obj_id__account, update_ae_obj__account, delete_ae_obj_id__account } from '$lib/ae_core/ae_core__account';
|
||||
import { editable_fields__account } from '$lib/ae_core/ae_core__account.editable_fields';
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { Save, Trash2, ArrowLeft, Building } from 'lucide-svelte';
|
||||
|
||||
let account_id = $page.params.account_id;
|
||||
let account: any = $state(null);
|
||||
let loading = $state(true);
|
||||
let saving = $state(false);
|
||||
|
||||
async function load_account() {
|
||||
loading = true;
|
||||
account = await load_ae_obj_id__account({
|
||||
api_cfg: $ae_api,
|
||||
account_id,
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
goto('/core');
|
||||
return;
|
||||
}
|
||||
load_account();
|
||||
});
|
||||
|
||||
async function handle_save() {
|
||||
saving = true;
|
||||
// Filter fields to only include editable ones
|
||||
const data_kv: any = {};
|
||||
editable_fields__account.forEach(field => {
|
||||
if (account[field] !== undefined) {
|
||||
data_kv[field] = account[field];
|
||||
}
|
||||
});
|
||||
|
||||
const result = await update_ae_obj__account({
|
||||
api_cfg: $ae_api,
|
||||
account_id,
|
||||
data_kv,
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if (result) {
|
||||
alert('Account updated successfully');
|
||||
}
|
||||
saving = false;
|
||||
}
|
||||
|
||||
async function handle_delete() {
|
||||
if (!confirm('Are you sure you want to disable this account?')) return;
|
||||
|
||||
const result = await delete_ae_obj_id__account({
|
||||
api_cfg: $ae_api,
|
||||
account_id,
|
||||
method: 'disable',
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if (result) {
|
||||
goto('/core/accounts');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-6">
|
||||
<header class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-4">
|
||||
<button class="btn btn-sm variant-soft" onclick={() => goto('/core/accounts')}>
|
||||
<ArrowLeft size={16} />
|
||||
</button>
|
||||
<div class="flex items-center gap-2">
|
||||
<Building size={24} />
|
||||
<h1 class="h2">{account?.name ?? 'Loading Account...'}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button class="btn variant-filled-error" onclick={handle_delete} disabled={loading || saving}>
|
||||
<Trash2 size={16} class="mr-2" /> Disable
|
||||
</button>
|
||||
<button class="btn variant-filled-primary" onclick={handle_save} disabled={loading || saving}>
|
||||
<Save size={16} class="mr-2" /> Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{#if loading}
|
||||
<div class="placeholder animate-pulse w-full h-64"></div>
|
||||
{:else if account}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div class="card p-4 space-y-4">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">Basic Information</h3>
|
||||
<label class="label">
|
||||
<span>Account Name</span>
|
||||
<input class="input" type="text" bind:value={account.name} />
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Short Name</span>
|
||||
<input class="input" type="text" bind:value={account.short_name} />
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Account Code</span>
|
||||
<input class="input" type="text" bind:value={account.code} />
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Description</span>
|
||||
<textarea class="textarea" rows="3" bind:value={account.description}></textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="card p-4 space-y-4">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">Settings & Status</h3>
|
||||
<div class="flex flex-col gap-4">
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={account.enable} />
|
||||
<p>Enabled</p>
|
||||
</label>
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={account.hide} />
|
||||
<p>Hidden</p>
|
||||
</label>
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={account.priority} />
|
||||
<p>Priority Account</p>
|
||||
</label>
|
||||
</div>
|
||||
<label class="label">
|
||||
<span>Group</span>
|
||||
<input class="input" type="text" bind:value={account.group} />
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Sort Order</span>
|
||||
<input class="input" type="number" bind:value={account.sort} />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="card p-4 space-y-4 md:col-span-2">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">Internal Notes</h3>
|
||||
<textarea class="textarea" rows="4" bind:value={account.notes} placeholder="Private notes for staff..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
100
src/routes/core/lookups/+page.svelte
Normal file
100
src/routes/core/lookups/+page.svelte
Normal file
@@ -0,0 +1,100 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { List, Globe, Clock, MapPin } from 'lucide-svelte';
|
||||
import { api } from '$lib/api/api';
|
||||
|
||||
let loading = $state(true);
|
||||
let lookups: any = $state({
|
||||
countries: [],
|
||||
time_zones: [],
|
||||
subdivisions: []
|
||||
});
|
||||
|
||||
async function load_lookups() {
|
||||
loading = true;
|
||||
// Using existing generic lookup loaders if available, or raw API calls
|
||||
const [countries, time_zones] = await Promise.all([
|
||||
api.get_ae_obj_li_for_lu({ api_cfg: $ae_api, for_lu_type: 'country', log_lvl: 0 }),
|
||||
api.get_ae_obj_li_for_lu({ api_cfg: $ae_api, for_lu_type: 'time_zone', log_lvl: 0 })
|
||||
]);
|
||||
|
||||
lookups.countries = countries || [];
|
||||
lookups.time_zones = time_zones || [];
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
goto('/core');
|
||||
return;
|
||||
}
|
||||
load_lookups();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-6">
|
||||
<header class="flex items-center gap-2">
|
||||
<List size={24} />
|
||||
<h1 class="h2">System Lookups</h1>
|
||||
</header>
|
||||
|
||||
{#if loading}
|
||||
<div class="placeholder animate-pulse w-full h-64"></div>
|
||||
{:else}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<!-- Countries -->
|
||||
<div class="card p-4 space-y-4">
|
||||
<header class="flex items-center gap-2 border-b border-surface-500/30 pb-2">
|
||||
<Globe size={18} />
|
||||
<h3 class="h4">Countries</h3>
|
||||
</header>
|
||||
<div class="table-container max-h-[400px] overflow-auto">
|
||||
<table class="table table-compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>ISO Alpha-2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each lookups.countries as c}
|
||||
<tr>
|
||||
<td>{c.name}</td>
|
||||
<td><code class="code">{c.alpha_2_code}</code></td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Time Zones -->
|
||||
<div class="card p-4 space-y-4">
|
||||
<header class="flex items-center gap-2 border-b border-surface-500/30 pb-2">
|
||||
<Clock size={18} />
|
||||
<h3 class="h4">Time Zones</h3>
|
||||
</header>
|
||||
<div class="table-container max-h-[400px] overflow-auto">
|
||||
<table class="table table-compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone Name</th>
|
||||
<th>Offset</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each lookups.time_zones as tz}
|
||||
<tr>
|
||||
<td>{tz.name}</td>
|
||||
<td>{tz.offset_seconds / 3600}h</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
133
src/routes/core/sites/+page.svelte
Normal file
133
src/routes/core/sites/+page.svelte
Normal file
@@ -0,0 +1,133 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { load_ae_obj_li__site, create_ae_obj__site } from '$lib/ae_core/ae_core__site';
|
||||
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { Plus, Search, Globe } from 'lucide-svelte';
|
||||
|
||||
let site_li: any[] = $state([]);
|
||||
let loading = $state(true);
|
||||
let qry_enabled = $state('all');
|
||||
let qry_hidden = $state('all');
|
||||
|
||||
async function load_sites() {
|
||||
if (!$ae_loc.account_id) return;
|
||||
loading = true;
|
||||
site_li = await load_ae_obj_li__site({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: $ae_loc.account_id,
|
||||
enabled: qry_enabled as any,
|
||||
hidden: qry_hidden as any,
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
load_sites();
|
||||
});
|
||||
|
||||
async function handle_add_site() {
|
||||
const name = prompt('Enter new site name:');
|
||||
if (!name) return;
|
||||
|
||||
const code = prompt('Enter site code (optional):');
|
||||
|
||||
const new_site = await create_ae_obj__site({
|
||||
api_cfg: $ae_api,
|
||||
account_id: $ae_loc.account_id,
|
||||
data_kv: {
|
||||
name,
|
||||
code: code || undefined,
|
||||
enable: true
|
||||
},
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
if (new_site) {
|
||||
load_sites();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-4">
|
||||
<header class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-2">
|
||||
<Globe size={24} />
|
||||
<h1 class="h2">Site Management</h1>
|
||||
</div>
|
||||
<button class="btn variant-filled-primary" onclick={handle_add_site}>
|
||||
<Plus size={16} class="mr-2" /> Add Site
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="card p-4 variant-soft flex flex-wrap gap-4 items-end">
|
||||
<label class="label">
|
||||
<span>Enabled Status</span>
|
||||
<select class="select" bind:value={qry_enabled} onchange={load_sites}>
|
||||
<option value="all">All</option>
|
||||
<option value="enabled">Enabled Only</option>
|
||||
<option value="not_enabled">Disabled Only</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Hidden Status</span>
|
||||
<select class="select" bind:value={qry_hidden} onchange={load_sites}>
|
||||
<option value="all">All</option>
|
||||
<option value="not_hidden">Not Hidden Only</option>
|
||||
<option value="hidden">Hidden Only</option>
|
||||
</select>
|
||||
</label>
|
||||
<button class="btn variant-filled-secondary" onclick={load_sites} disabled={loading}>
|
||||
<Search size={16} class="mr-2" /> Refresh
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if loading}
|
||||
<div class="flex justify-center p-12">
|
||||
<div class="placeholder animate-pulse w-full h-32"></div>
|
||||
</div>
|
||||
{:else if site_li.length === 0}
|
||||
<div class="card p-8 text-center">
|
||||
<p>No sites found for this account matching your filters.</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="table-container">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Code</th>
|
||||
<th>Created</th>
|
||||
<th>Status</th>
|
||||
<th class="text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each site_li as site}
|
||||
<tr>
|
||||
<td>{site.name}</td>
|
||||
<td><code class="code">{site.code || '--'}</code></td>
|
||||
<td>{new Date(site.created_on).toLocaleDateString()}</td>
|
||||
<td>
|
||||
{#if site.enable}
|
||||
<span class="badge variant-filled-success">Enabled</span>
|
||||
{:else}
|
||||
<span class="badge variant-filled-error">Disabled</span>
|
||||
{/if}
|
||||
{#if site.hide}
|
||||
<span class="badge variant-filled-warning">Hidden</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-sm variant-soft-primary" onclick={() => goto(`/core/sites/${site.site_id_random}`)}>
|
||||
Manage
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
5
src/routes/core/sites/+page.ts
Normal file
5
src/routes/core/sites/+page.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
return {};
|
||||
};
|
||||
223
src/routes/core/sites/[site_id]/+page.svelte
Normal file
223
src/routes/core/sites/[site_id]/+page.svelte
Normal file
@@ -0,0 +1,223 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import {
|
||||
load_ae_obj_id__site,
|
||||
update_ae_obj__site,
|
||||
delete_ae_obj_id__site,
|
||||
load_ae_obj_li__site_domain,
|
||||
create_ae_obj__site_domain,
|
||||
update_ae_obj__site_domain,
|
||||
delete_ae_obj_id__site_domain
|
||||
} from '$lib/ae_core/ae_core__site';
|
||||
import { editable_fields__site } from '$lib/ae_core/ae_core__site.editable_fields';
|
||||
import { editable_fields__site_domain } from '$lib/ae_core/ae_core__site_domain.editable_fields';
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { Save, Trash2, ArrowLeft, Globe, Plus, ExternalLink } from 'lucide-svelte';
|
||||
|
||||
let site_id = $page.params.site_id;
|
||||
let site: any = $state(null);
|
||||
let domain_li: any[] = $state([]);
|
||||
let loading = $state(true);
|
||||
let saving = $state(false);
|
||||
|
||||
async function load_data() {
|
||||
loading = true;
|
||||
site = await load_ae_obj_id__site({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
log_lvl: 1
|
||||
});
|
||||
domain_li = await load_ae_obj_li__site_domain({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
goto('/core');
|
||||
return;
|
||||
}
|
||||
load_data();
|
||||
});
|
||||
|
||||
async function handle_save_site() {
|
||||
saving = true;
|
||||
const data_kv: any = {};
|
||||
editable_fields__site.forEach(field => {
|
||||
if (site[field] !== undefined) {
|
||||
data_kv[field] = site[field];
|
||||
}
|
||||
});
|
||||
|
||||
await update_ae_obj__site({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
data_kv,
|
||||
log_lvl: 1
|
||||
});
|
||||
saving = false;
|
||||
}
|
||||
|
||||
async function handle_add_domain() {
|
||||
const fqdn = prompt('Enter new domain (e.g. example.com):');
|
||||
if (!fqdn) return;
|
||||
|
||||
await create_ae_obj__site_domain({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
data_kv: { fqdn, enable: true },
|
||||
log_lvl: 1
|
||||
});
|
||||
load_data();
|
||||
}
|
||||
|
||||
async function handle_toggle_domain(dom: any) {
|
||||
await update_ae_obj__site_domain({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
site_domain_id: dom.site_domain_id_random,
|
||||
data_kv: { enable: !dom.enable },
|
||||
log_lvl: 1
|
||||
});
|
||||
load_data();
|
||||
}
|
||||
|
||||
async function handle_delete_domain(dom: any) {
|
||||
if (!confirm(`Remove domain ${dom.fqdn}?`)) return;
|
||||
await delete_ae_obj_id__site_domain({
|
||||
api_cfg: $ae_api,
|
||||
site_id,
|
||||
site_domain_id: dom.site_domain_id_random,
|
||||
method: 'delete',
|
||||
log_lvl: 1
|
||||
});
|
||||
load_data();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-6">
|
||||
<header class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-4">
|
||||
<button class="btn btn-sm variant-soft" onclick={() => goto('/core/sites')}>
|
||||
<ArrowLeft size={16} />
|
||||
</button>
|
||||
<div class="flex items-center gap-2">
|
||||
<Globe size={24} />
|
||||
<h1 class="h2">{site?.name ?? 'Loading Site...'}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn variant-filled-primary" onclick={handle_save_site} disabled={loading || saving}>
|
||||
<Save size={16} class="mr-2" /> Save Site Changes
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{#if loading}
|
||||
<div class="placeholder animate-pulse w-full h-64"></div>
|
||||
{:else if site}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- Site Config -->
|
||||
<div class="lg:col-span-2 space-y-6">
|
||||
<div class="card p-4 space-y-4">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">Site Configuration</h3>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<label class="label">
|
||||
<span>Site Name</span>
|
||||
<input class="input" type="text" bind:value={site.name} />
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Site Code</span>
|
||||
<input class="input" type="text" bind:value={site.code} />
|
||||
</label>
|
||||
<label class="label md:col-span-2">
|
||||
<span>Tagline</span>
|
||||
<input class="input" type="text" bind:value={site.tagline} />
|
||||
</label>
|
||||
<label class="label md:col-span-2">
|
||||
<span>Description</span>
|
||||
<textarea class="textarea" rows="2" bind:value={site.description}></textarea>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card p-4 space-y-4">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">Access Control</h3>
|
||||
<div class="flex flex-col gap-4">
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={site.restrict_access} />
|
||||
<p>Restrict Access</p>
|
||||
</label>
|
||||
{#if site.restrict_access}
|
||||
<label class="label">
|
||||
<span>Access Key</span>
|
||||
<input class="input" type="text" bind:value={site.access_key} />
|
||||
</label>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Domains Management -->
|
||||
<div class="space-y-6">
|
||||
<div class="card p-4 space-y-4">
|
||||
<header class="flex justify-between items-center border-b border-surface-500/30 pb-2">
|
||||
<h3 class="h4">Site Domains</h3>
|
||||
<button class="btn btn-sm variant-filled-secondary" onclick={handle_add_domain}>
|
||||
<Plus size={14} />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{#if domain_li.length === 0}
|
||||
<p class="text-sm opacity-60 text-center py-4">No domains configured.</p>
|
||||
{:else}
|
||||
<div class="space-y-2">
|
||||
{#each domain_li as dom}
|
||||
<div class="card p-3 variant-soft flex justify-between items-center">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium flex items-center gap-1">
|
||||
{dom.fqdn}
|
||||
<a href="https://{dom.fqdn}" target="_blank" class="opacity-50 hover:opacity-100">
|
||||
<ExternalLink size={12} />
|
||||
</a>
|
||||
</span>
|
||||
<span class="text-xs opacity-60">
|
||||
Key: <code class="code text-[10px]">{dom.access_key || '--'}</code> | {dom.enable ? 'Active' : 'Disabled'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
<button class="btn btn-icon btn-sm {dom.enable ? 'variant-soft-success' : 'variant-soft-error'}" onclick={() => handle_toggle_domain(dom)} title="Toggle Active">
|
||||
<Save size={14} />
|
||||
</button>
|
||||
<button class="btn btn-icon btn-sm variant-soft-error" onclick={() => handle_delete_domain(dom)} title="Delete Domain">
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="card p-4 space-y-4">
|
||||
<h3 class="h4 border-b border-surface-500/30 pb-2">System Status</h3>
|
||||
<div class="space-y-4">
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={site.enable} />
|
||||
<p>Site Enabled</p>
|
||||
</label>
|
||||
<label class="flex items-center space-x-2">
|
||||
<input class="checkbox" type="checkbox" bind:checked={site.hide} />
|
||||
<p>Hidden</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
113
src/routes/core/users/+page.svelte
Normal file
113
src/routes/core/users/+page.svelte
Normal file
@@ -0,0 +1,113 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { load_ae_obj_li__user, create_ae_obj__user } from '$lib/ae_core/ae_core__user';
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { Plus, Search, User, ShieldCheck, Mail } from 'lucide-svelte';
|
||||
|
||||
let user_li: any[] = $state([]);
|
||||
let loading = $state(true);
|
||||
let qry_str = $state('');
|
||||
let qry_enabled = $state('all');
|
||||
|
||||
async function load_users() {
|
||||
loading = true;
|
||||
user_li = await load_ae_obj_li__user({
|
||||
api_cfg: $ae_api,
|
||||
qry_str: qry_str || null,
|
||||
enabled: qry_enabled as any,
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$ae_loc.manager_access) {
|
||||
goto('/core');
|
||||
return;
|
||||
}
|
||||
load_users();
|
||||
});
|
||||
|
||||
async function handle_add_user() {
|
||||
const username = prompt('Enter new username:');
|
||||
if (!username) return;
|
||||
const email = prompt('Enter email address:');
|
||||
|
||||
await create_ae_obj__user({
|
||||
api_cfg: $ae_api,
|
||||
data_kv: { username, email, enable: true },
|
||||
log_lvl: 1
|
||||
});
|
||||
load_users();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto p-4 space-y-4">
|
||||
<header class="flex justify-between items-center">
|
||||
<div class="flex items-center gap-2">
|
||||
<ShieldCheck size={24} />
|
||||
<h1 class="h2">User Management</h1>
|
||||
</div>
|
||||
<button class="btn variant-filled-primary" onclick={handle_add_user}>
|
||||
<Plus size={16} class="mr-2" /> Add User
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="card p-4 variant-soft flex flex-wrap gap-4 items-end">
|
||||
<label class="label flex-1">
|
||||
<span>Search Username or Email</span>
|
||||
<div class="input-group input-group-divider grid-cols-[auto_1fr_auto]">
|
||||
<div class="input-group-shim"><Search size={16} /></div>
|
||||
<input type="search" bind:value={qry_str} placeholder="Search..." onkeydown={(e) => e.key === 'Enter' && load_users()} />
|
||||
<button class="variant-filled-secondary" onclick={load_users}>Go</button>
|
||||
</div>
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>Status</span>
|
||||
<select class="select w-32" bind:value={qry_enabled} onchange={load_users}>
|
||||
<option value="all">All</option>
|
||||
<option value="enabled">Enabled</option>
|
||||
<option value="not_enabled">Disabled</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{#if loading}
|
||||
<div class="placeholder animate-pulse w-full h-64"></div>
|
||||
{:else if user_li.length === 0}
|
||||
<p class="text-center py-12 opacity-60">No users found.</p>
|
||||
{:else}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{#each user_li as user}
|
||||
<div class="card p-4 space-y-3 variant-soft flex flex-col justify-between">
|
||||
<div class="space-y-2">
|
||||
<header class="flex justify-between items-start">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="avatar variant-filled-surface w-10 h-10 flex items-center justify-center rounded-full">
|
||||
<User size={20} />
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-bold">{user.username}</p>
|
||||
<p class="text-xs opacity-60">{user.name || '--'}</p>
|
||||
</div>
|
||||
</div>
|
||||
{#if user.super}
|
||||
<span class="badge variant-filled-error">Super</span>
|
||||
{:else if user.manager}
|
||||
<span class="badge variant-filled-warning">Manager</span>
|
||||
{/if}
|
||||
</header>
|
||||
<div class="flex items-center gap-2 text-sm opacity-80">
|
||||
<Mail size={14} />
|
||||
<span>{user.email || '--'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-sm variant-filled-primary w-full" onclick={() => goto(`/core/users/${user.user_id_random}`)}>
|
||||
Edit User
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
Reference in New Issue
Block a user