Files
EpicNext-Cms/prisma/migrations/0017_notifications_webhooks.sql
T
openhands 83f4585167
Local Build and Deploy / deploy (push) Successful in 1m5s
Feature: Plugin UI, event hooks, DB notifications, web push, webhook retry, games pages, rate limiting, tests
- Plugin admin UI: enable/disable per plugin with config forms
- Event hooks system: HookManager with on/off/emit for plugin events
- Database notifications: persistent via WebsiteNotification table + Redis pub/sub
- Notification preferences: per-user settings with API endpoints
- Web Push API: browser push notification subscription
- Webhook retry: 3 attempts with exponential backoff (1s/3s/9s) + delivery logs
- Webhook test button + paginated delivery log viewer
- Games: rank/challenge/reward admin pages
- Games: public frontend leaderboard
- Rate limiting: search API (30/min), notification stream dedup
- Unit tests: 28 new tests (registry, notifications, webhooks)
- Prisma migration 0017: website_notifications, website_notification_preferences, website_webhook_logs
2026-07-18 14:04:41 +02:00

49 lines
1.7 KiB
SQL

-- Notifications
CREATE TABLE IF NOT EXISTS `website_notifications` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` BIGINT UNSIGNED NOT NULL,
`type` VARCHAR(50) NOT NULL,
`title` VARCHAR(255) NOT NULL,
`body` TEXT DEFAULT NULL,
`icon` VARCHAR(50) DEFAULT NULL,
`link` VARCHAR(500) DEFAULT NULL,
`read` TINYINT(1) NOT NULL DEFAULT 0,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `idx_user_read` (`user_id`, `read`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Notification preferences
CREATE TABLE IF NOT EXISTS `website_notification_preferences` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` BIGINT UNSIGNED NOT NULL,
`email_enabled` TINYINT(1) NOT NULL DEFAULT 1,
`push_enabled` TINYINT(1) NOT NULL DEFAULT 1,
`friend_request` TINYINT(1) NOT NULL DEFAULT 1,
`messages` TINYINT(1) NOT NULL DEFAULT 1,
`guild_invite` TINYINT(1) NOT NULL DEFAULT 1,
`events` TINYINT(1) NOT NULL DEFAULT 1,
`alerts` TINYINT(1) NOT NULL DEFAULT 1,
`achievements` TINYINT(1) NOT NULL DEFAULT 1,
`radio` TINYINT(1) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Webhook delivery logs
CREATE TABLE IF NOT EXISTS `website_webhook_logs` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`webhook_id` VARCHAR(100) NOT NULL,
`url` VARCHAR(500) NOT NULL,
`event` VARCHAR(100) NOT NULL,
`status` INT NOT NULL DEFAULT 0,
`response` TEXT DEFAULT NULL,
`duration` INT NOT NULL DEFAULT 0,
`success` TINYINT(1) NOT NULL DEFAULT 0,
`created_at` TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `idx_webhook_logs` (`webhook_id`, `created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Migration tracking