diff --git a/database/schema.sql b/database/schema.sql deleted file mode 100644 index e8be017..0000000 --- a/database/schema.sql +++ /dev/null @@ -1,85 +0,0 @@ --- ============================================ --- PlusFit24 Datenbank Schema --- Auf dem MariaDB Server ausführen --- ============================================ - -CREATE DATABASE IF NOT EXISTS plusfit24 - CHARACTER SET utf8mb4 - COLLATE utf8mb4_unicode_ci; - -USE plusfit24; - --- Kategorien Tabelle -CREATE TABLE IF NOT EXISTS categories ( - id INT AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -INSERT INTO categories (name) VALUES -('Single'), -('Schüler / Studenten / Vereine'), -('Family'), -('Sonstige'); - --- Tarife Tabelle -CREATE TABLE IF NOT EXISTS tariffs ( - id INT AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL, - category_id INT, - duration_months INT NOT NULL, - price_monthly DECIMAL(10,2) NOT NULL, - start_package_price DECIMAL(10,2) DEFAULT 35.00, - description TEXT, - active TINYINT(1) DEFAULT 1, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE SET NULL -); - -INSERT INTO tariffs (name, category_id, duration_months, price_monthly, start_package_price, description) VALUES -('Single 12 Monate', 1, 12, 29.95, 35.00, 'Einzelmitgliedschaft für 12 Monate'), -('Single 24 Monate', 1, 24, 19.95, 35.00, 'Einzelmitgliedschaft für 24 Monate'), -('Schüler - Studenten - Vereine 12 Monate', 2, 12, 28.95, 35.00, 'Ermäßigter Tarif'), -('Family 24 Monate', 3, 24, 49.95, 35.00, 'Familientarif für 24 Monate'); - --- Mitgliedschaften Tabelle -CREATE TABLE IF NOT EXISTS memberships ( - id INT AUTO_INCREMENT PRIMARY KEY, - tariff_id INT NOT NULL, - salutation VARCHAR(20) NOT NULL, - title VARCHAR(50), - first_name VARCHAR(100) NOT NULL, - last_name VARCHAR(100) NOT NULL, - birth_date DATE NOT NULL, - email VARCHAR(255) NOT NULL, - phone VARCHAR(50), - street VARCHAR(200) NOT NULL, - address_addition VARCHAR(200), - zip VARCHAR(10) NOT NULL, - city VARCHAR(100) NOT NULL, - bank_name VARCHAR(200), - account_holder VARCHAR(200), - iban VARCHAR(34), - sepa_accepted TINYINT(1) DEFAULT 0, - agb_accepted TINYINT(1) DEFAULT 0, - datenschutz_accepted TINYINT(1) DEFAULT 0, - data_correct TINYINT(1) DEFAULT 0, - guardian_consent TINYINT(1) DEFAULT 0, - is_minor TINYINT(1) DEFAULT 0, - status VARCHAR(20) DEFAULT 'active', - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (tariff_id) REFERENCES tariffs(id) -); - --- Admin Tabelle -CREATE TABLE IF NOT EXISTS admins ( - id INT AUTO_INCREMENT PRIMARY KEY, - username VARCHAR(100) NOT NULL UNIQUE, - password_hash VARCHAR(255) NOT NULL, - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -CREATE INDEX idx_memberships_email ON memberships(email); -CREATE INDEX idx_memberships_status ON memberships(status); -CREATE INDEX idx_tariffs_active ON tariffs(active); diff --git a/nginx/plusfit24.conf b/nginx/plusfit24.conf deleted file mode 100644 index 4520884..0000000 --- a/nginx/plusfit24.conf +++ /dev/null @@ -1,28 +0,0 @@ -# ===================================================== -# NGINX Konfiguration für plusfit24.software-joksch.com -# Datei speichern unter: /etc/nginx/sites-available/plusfit24 -# Symlink: ln -s /etc/nginx/sites-available/plusfit24 /etc/nginx/sites-enabled/ -# ===================================================== - -server { - listen 443 ssl http2; - server_name plusfit24.software-joksch.com; - - # SSL – gleiche Zertifikate wie deine anderen vHosts - ssl_certificate /etc/nginx/ssl/fullchain.pem; - ssl_certificate_key /etc/nginx/ssl/software-joksch.com.key; - - client_max_body_size 10M; - - location / { - proxy_pass http://192.168.0.163:3100; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_redirect off; - proxy_read_timeout 3600; - } -} diff --git a/routes/admin.js b/routes/admin.js index dfad734..418497a 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -140,17 +140,6 @@ router.post('/tariffs/:id/update', requireAdmin, async (req, res) => { } }); -router.post('/tariffs/:id/delete', requireAdmin, async (req, res) => { - try { - const [members] = await db.query('SELECT COUNT(*) as c FROM memberships WHERE tariff_id = ?', [req.params.id]); - if (members[0].c > 0) return res.redirect('/admin?error=Tarif+hat+Mitglieder+–+bitte+deaktivieren'); - await db.query('DELETE FROM tariffs WHERE id = ?', [req.params.id]); - res.redirect('/admin?success=Tarif+gelöscht'); - } catch (err) { - res.redirect('/admin?error=Fehler+beim+Löschen'); - } -}); - // Passwort ändern router.post('/change-password', requireAdmin, async (req, res) => { const { current_password, new_password, confirm_password } = req.body; diff --git a/views/admin/dashboard.ejs b/views/admin/dashboard.ejs index 9d6b6e8..7b30a6b 100644 --- a/views/admin/dashboard.ejs +++ b/views/admin/dashboard.ejs @@ -80,10 +80,6 @@ <%= tariff.active ? '⏸ Deaktivieren' : '▶ Aktivieren' %> -
<% }) %>