feat: add tournament suggestions job and notification system
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 56s

- Implemented a scheduled job for fetching tournament suggestions in the scheduler service.
- Added a new service for handling tournament suggestions, including fetching and updating suggestions.
- Created notification system with models, controllers, and services for managing user notifications.
- Introduced a notification bell component in the frontend to display unread notifications.
- Added a notifications view for users to see all notifications and mark them as read.
- Updated API client and socket service to handle notifications and authentication.
- Created database migrations for notifications and tournament suggestions.
This commit is contained in:
Torsten Schulz (local)
2026-08-14 11:14:07 +02:00
parent 351fe588c1
commit bc9e7cfe3c
26 changed files with 643 additions and 13 deletions

View File

@@ -0,0 +1,33 @@
CREATE TABLE IF NOT EXISTS notification_events (
id BIGINT NOT NULL AUTO_INCREMENT,
club_id INT NULL,
type VARCHAR(80) NOT NULL,
priority ENUM('low', 'normal', 'high', 'critical') NOT NULL DEFAULT 'normal',
resource_type VARCHAR(80) NULL,
resource_id VARCHAR(80) NULL,
title VARCHAR(255) NOT NULL,
body TEXT NULL,
route VARCHAR(500) NULL,
payload JSON NULL,
dedupe_key VARCHAR(255) NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_notification_events_dedupe_key (dedupe_key),
KEY idx_notification_events_club_created (club_id, created_at)
);
CREATE TABLE IF NOT EXISTS notification_recipients (
id BIGINT NOT NULL AUTO_INCREMENT,
event_id BIGINT NOT NULL,
user_id INT NOT NULL,
read_at DATETIME NULL,
archived_at DATETIME NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_notification_recipients_event_user (event_id, user_id),
KEY idx_notification_recipients_user_read_created (user_id, read_at, created_at),
CONSTRAINT fk_notification_recipients_event FOREIGN KEY (event_id) REFERENCES notification_events(id) ON DELETE CASCADE,
CONSTRAINT fk_notification_recipients_user FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE
);

View File

@@ -0,0 +1,19 @@
CREATE TABLE IF NOT EXISTS tournament_suggestions (
id BIGINT NOT NULL AUTO_INCREMENT,
club_id INT NOT NULL,
federation VARCHAR(32) NOT NULL,
title VARCHAR(255) NOT NULL,
event_date VARCHAR(32) NULL,
organizer VARCHAR(255) NULL,
location VARCHAR(255) NULL,
source_url VARCHAR(1000) NOT NULL,
source_fingerprint VARCHAR(128) NOT NULL,
status ENUM('new', 'reviewed', 'dismissed') NOT NULL DEFAULT 'new',
last_seen_at DATETIME NOT NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_tournament_suggestions_source_fingerprint (source_fingerprint),
KEY idx_tournament_suggestions_club_status_date (club_id, status, event_date),
CONSTRAINT fk_tournament_suggestions_club FOREIGN KEY (club_id) REFERENCES clubs(id) ON DELETE CASCADE
);