Add invite routes to backend and frontend; implement routing and UI components for invitation management
This commit is contained in:
28
backend/create-invitation-table.sql
Normal file
28
backend/create-invitation-table.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- SQL Script: Invitation-Tabelle erstellen
|
||||
-- Speichert gesendete Einladungen mit Spam-Schutz
|
||||
-- Ausführen mit: mysql -u root -p stechuhr < create-invitation-table.sql
|
||||
|
||||
USE stechuhr;
|
||||
|
||||
-- Erstelle Invitation-Tabelle falls nicht vorhanden
|
||||
CREATE TABLE IF NOT EXISTS invitation (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
inviter_user_id BIGINT NOT NULL,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
token VARCHAR(255) NOT NULL UNIQUE,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at DATETIME NOT NULL,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
||||
|
||||
-- Foreign Keys
|
||||
CONSTRAINT fk_invitation_user FOREIGN KEY (inviter_user_id)
|
||||
REFERENCES user(id) ON DELETE CASCADE,
|
||||
|
||||
-- Indices für Performance
|
||||
INDEX idx_invitation_token (token),
|
||||
INDEX idx_invitation_email_created (email, created_at),
|
||||
INDEX idx_invitation_status (status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
SELECT 'Invitation-Tabelle erfolgreich erstellt oder bereits vorhanden.' AS status;
|
||||
|
||||
Reference in New Issue
Block a user