styles geändert

This commit is contained in:
2025-02-19 21:01:55 +01:00
parent 2b53b40778
commit 209a23509b
5 changed files with 152 additions and 169 deletions

View File

@@ -32,7 +32,6 @@ def close_connection(exception):
def init_db():
with app.app_context():
db = get_db()
# Users
db.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -42,7 +41,6 @@ def init_db():
is_admin INTEGER DEFAULT 0
);
""")
# Bookmarks
db.execute("""
CREATE TABLE IF NOT EXISTS bookmarks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -53,11 +51,10 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Notifications
db.execute("""
CREATE TABLE IF NOT EXISTS notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER, -- NULL = für alle
user_id INTEGER,
message TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
is_read INTEGER DEFAULT 0
@@ -71,7 +68,6 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Time Tracking
db.execute("""
CREATE TABLE IF NOT EXISTS time_entries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -82,7 +78,6 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
# Settings (OPTIONAL, falls du globale User-Einstellungen abspeichern willst)
db.execute("""
CREATE TABLE IF NOT EXISTS user_settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -94,19 +89,8 @@ def init_db():
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
db.execute("""
CREATE TABLE IF NOT EXISTS settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
wallpaper TEXT DEFAULT '19.png',
city TEXT DEFAULT 'Berlin',
show_forecast INTEGER DEFAULT 1,
bookmarks TEXT DEFAULT '[]',
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
""")
db.commit()
# ------------------------------------------------------------
# HILFSFUNKTIONEN
# ------------------------------------------------------------
@@ -204,7 +188,7 @@ def login():
flash("Benutzername oder Passwort falsch!", "red")
return render_template('login.html')
@app.route('/logout', methods=['POST'])
@app.route('/logout', methods=['GET', 'POST'])
def logout():
session.clear()
flash("Erfolgreich abgemeldet!", "green")