- New tables: app_config, notifications - Admin views: App Version editor, Notification sender - API: GET /api/notifications, POST /api/notifications/:id/read, POST /api/notifications/read-all - App version now stored in DB, editable by super admin - Notifications: send to all users or specific user - Android notification models + API client - Sidebar: App Version + Notifications links for super_admin
25 lines
1.2 KiB
SQL
25 lines
1.2 KiB
SQL
CREATE TABLE IF NOT EXISTS app_config (
|
|
`key` VARCHAR(64) PRIMARY KEY,
|
|
`value` TEXT NOT NULL,
|
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
INSERT IGNORE INTO app_config (`key`, `value`) VALUES ('app_version', '1.0.1');
|
|
INSERT IGNORE INTO app_config (`key`, `value`) VALUES ('apk_url', '/sysadmin.apk');
|
|
INSERT IGNORE INTO app_config (`key`, `value`) VALUES ('force_update', '0');
|
|
INSERT IGNORE INTO app_config (`key`, `value`) VALUES ('release_notes', '• Initial release\n• Server management\n• SSH terminal');
|
|
|
|
CREATE TABLE IF NOT EXISTS notifications (
|
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
|
user_id INT UNSIGNED DEFAULT NULL,
|
|
title VARCHAR(255) NOT NULL,
|
|
message TEXT NOT NULL,
|
|
type ENUM('info','warning','success','error') NOT NULL DEFAULT 'info',
|
|
is_read TINYINT(1) NOT NULL DEFAULT 0,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
read_at DATETIME DEFAULT NULL,
|
|
INDEX idx_user_id (user_id),
|
|
INDEX idx_is_read (is_read),
|
|
INDEX idx_created_at (created_at)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|