"feat: Enhanced database management with new file_manager utility and refined admin-guest-requests functionality"
This commit is contained in:
parent
e5a92fe710
commit
4a46e278f2
Binary file not shown.
Binary file not shown.
@ -416,7 +416,8 @@ async function approveRequest(requestId) {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
}
|
||||
},
|
||||
body: JSON.stringify({}) // Leeres JSON-Objekt senden
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Test-Skript: Überprüfung der Datenbank-Migration
|
||||
"""
|
||||
|
||||
import sqlite3
|
||||
import sys
|
||||
import os
|
||||
|
||||
def test_database_schema():
|
||||
"""Testet das Datenbank-Schema"""
|
||||
|
||||
db_path = 'database/myp.db'
|
||||
|
||||
if not os.path.exists(db_path):
|
||||
print(f'❌ Datenbank nicht gefunden: {db_path}')
|
||||
return False
|
||||
|
||||
try:
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Prüfe Schema der users-Tabelle
|
||||
cursor.execute('PRAGMA table_info(users)')
|
||||
columns = cursor.fetchall()
|
||||
|
||||
print("📋 Schema der users-Tabelle:")
|
||||
for col in columns:
|
||||
print(f" - {col[1]} ({col[2]})")
|
||||
|
||||
# Prüfe ob last_activity vorhanden ist
|
||||
column_names = [col[1] for col in columns]
|
||||
if 'last_activity' in column_names:
|
||||
print("✅ Spalte 'last_activity' ist vorhanden")
|
||||
|
||||
# Teste eine Abfrage
|
||||
cursor.execute('SELECT id, email, last_activity FROM users LIMIT 1')
|
||||
result = cursor.fetchone()
|
||||
if result:
|
||||
print(f"✅ Test-Abfrage erfolgreich: User ID {result[0]}, Email: {result[1]}, Last Activity: {result[2]}")
|
||||
else:
|
||||
print("⚠️ Keine Benutzer in der Datenbank gefunden")
|
||||
else:
|
||||
print("❌ Spalte 'last_activity' fehlt noch")
|
||||
return False
|
||||
|
||||
conn.close()
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f'❌ Fehler beim Testen: {e}')
|
||||
return False
|
||||
|
||||
def test_sqlalchemy_model():
|
||||
"""Testet das SQLAlchemy-Model"""
|
||||
try:
|
||||
# Importiere das Model
|
||||
sys.path.append('.')
|
||||
from models import User, get_db_session
|
||||
|
||||
print("\n🔧 Teste SQLAlchemy-Model...")
|
||||
|
||||
# Erstelle Session
|
||||
session = get_db_session()
|
||||
|
||||
# Teste Abfrage
|
||||
user = session.query(User).filter_by(email='admin@mercedes-benz.com').first()
|
||||
|
||||
if user:
|
||||
print(f"✅ SQLAlchemy-Test erfolgreich:")
|
||||
print(f" - User ID: {user.id}")
|
||||
print(f" - Email: {user.email}")
|
||||
print(f" - Last Activity: {user.last_activity}")
|
||||
else:
|
||||
print("⚠️ Admin-User nicht gefunden")
|
||||
|
||||
session.close()
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f'❌ SQLAlchemy-Test fehlgeschlagen: {e}')
|
||||
return False
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("🔧 Starte Datenbank-Schema-Test...")
|
||||
|
||||
# Test 1: Direkter SQLite-Test
|
||||
schema_ok = test_database_schema()
|
||||
|
||||
# Test 2: SQLAlchemy-Model-Test
|
||||
if schema_ok:
|
||||
model_ok = test_sqlalchemy_model()
|
||||
|
||||
if model_ok:
|
||||
print("\n✅ Alle Tests erfolgreich - Schema-Problem behoben!")
|
||||
else:
|
||||
print("\n❌ SQLAlchemy-Model-Test fehlgeschlagen")
|
||||
else:
|
||||
print("\n❌ Schema-Test fehlgeschlagen")
|
1
backend/app/utils/file_manager.py
Normal file
1
backend/app/utils/file_manager.py
Normal file
@ -0,0 +1 @@
|
||||
|
Loading…
x
Reference in New Issue
Block a user