📝 🎉 Improved session management system with new backup database and enhanced logs 🌐

This commit is contained in:
2025-06-12 08:23:49 +02:00
parent 841d4cc466
commit f2be2e65a8
103 changed files with 1351 additions and 508 deletions

View File

@ -20,6 +20,7 @@ from flask_wtf.csrf import CSRFError
from sqlalchemy import event from sqlalchemy import event
from contextlib import contextmanager from contextlib import contextmanager
import threading import threading
import uuid
# ===== MINIMALE SESSION-DATENKLASSE ===== # ===== MINIMALE SESSION-DATENKLASSE =====
class MinimalSessionInterface: class MinimalSessionInterface:
@ -1563,12 +1564,25 @@ def api_admin_create_printer():
db_session = get_db_session() db_session = get_db_session()
# Prüfen ob Name bereits existiert
existing_printer = db_session.query(Printer).filter(Printer.name == data["name"]).first()
if existing_printer:
db_session.close()
return jsonify({"error": "Ein Drucker mit diesem Namen existiert bereits"}), 409
# MAC-Adresse generieren falls nicht vorhanden
mac_address = data.get("mac_address")
if not mac_address:
# Generiere eine eindeutige MAC-Adresse
mac_address = "00:50:56:" + ":".join([f"{uuid.uuid4().hex[:2]}" for _ in range(3)])
# Neuen Drucker erstellen # Neuen Drucker erstellen
new_printer = Printer( new_printer = Printer(
name=data["name"], name=data["name"],
model=data["model"], model=data["model"],
location=data.get("location", ""), location=data.get("location", ""),
ip_address=data.get("ip_address"), ip_address=data.get("ip_address"),
mac_address=mac_address,
plug_ip=data.get("plug_ip"), plug_ip=data.get("plug_ip"),
plug_username=data.get("plug_username"), plug_username=data.get("plug_username"),
plug_password=data.get("plug_password"), plug_password=data.get("plug_password"),
@ -1584,18 +1598,22 @@ def api_admin_create_printer():
"name": new_printer.name, "name": new_printer.name,
"model": new_printer.model, "model": new_printer.model,
"location": new_printer.location, "location": new_printer.location,
"ip_address": new_printer.ip_address,
"mac_address": new_printer.mac_address,
"plug_ip": new_printer.plug_ip,
"status": new_printer.status, "status": new_printer.status,
"active": new_printer.active "active": new_printer.active,
"created_at": new_printer.created_at.isoformat() if new_printer.created_at else None
} }
db_session.close() db_session.close()
app_logger.info(f"✅ Admin API: Neuer Drucker '{new_printer.name}' erstellt") app_logger.info(f"✅ Admin API: Neuer Drucker '{new_printer.name}' erstellt")
return jsonify({"printer": printer_dict}), 201 return jsonify({"success": True, "printer": printer_dict, "message": "Drucker erfolgreich erstellt"}), 201
except Exception as e: except Exception as e:
app_logger.error(f"❌ Admin API-Fehler beim Erstellen des Druckers: {str(e)}") app_logger.error(f"❌ Admin API-Fehler beim Erstellen des Druckers: {str(e)}")
return jsonify({"error": "Fehler beim Erstellen des Druckers", "details": str(e)}), 500 return jsonify({"success": False, "error": "Fehler beim Erstellen des Druckers", "details": str(e)}), 500
@app.route("/api/admin/printers/<int:printer_id>", methods=["PUT"]) @app.route("/api/admin/printers/<int:printer_id>", methods=["PUT"])
@login_required @login_required
@ -1616,6 +1634,16 @@ def api_admin_update_printer(printer_id):
db_session.close() db_session.close()
return jsonify({"error": "Drucker nicht gefunden"}), 404 return jsonify({"error": "Drucker nicht gefunden"}), 404
# Prüfen ob neuer Name bereits existiert (falls Name geändert wird)
if "name" in data and data["name"] != printer.name:
existing_printer = db_session.query(Printer).filter(
Printer.name == data["name"],
Printer.id != printer_id
).first()
if existing_printer:
db_session.close()
return jsonify({"error": "Ein Drucker mit diesem Namen existiert bereits"}), 409
# Felder aktualisieren # Felder aktualisieren
if "name" in data: if "name" in data:
printer.name = data["name"] printer.name = data["name"]
@ -1625,6 +1653,8 @@ def api_admin_update_printer(printer_id):
printer.location = data["location"] printer.location = data["location"]
if "ip_address" in data: if "ip_address" in data:
printer.ip_address = data["ip_address"] printer.ip_address = data["ip_address"]
if "mac_address" in data:
printer.mac_address = data["mac_address"]
if "plug_ip" in data: if "plug_ip" in data:
printer.plug_ip = data["plug_ip"] printer.plug_ip = data["plug_ip"]
if "plug_username" in data: if "plug_username" in data:
@ -1645,24 +1675,70 @@ def api_admin_update_printer(printer_id):
"name": printer.name, "name": printer.name,
"model": printer.model, "model": printer.model,
"location": printer.location, "location": printer.location,
"ip_address": printer.ip_address,
"mac_address": printer.mac_address,
"plug_ip": printer.plug_ip,
"status": printer.status, "status": printer.status,
"active": printer.active "active": printer.active,
"created_at": printer.created_at.isoformat() if printer.created_at else None,
"updated_at": printer.updated_at.isoformat() if printer.updated_at else None,
"last_checked": printer.last_checked.isoformat() if printer.last_checked else None
} }
db_session.close() db_session.close()
app_logger.info(f"✅ Admin API: Drucker {printer_id} aktualisiert") app_logger.info(f"✅ Admin API: Drucker {printer_id} aktualisiert")
return jsonify({"printer": printer_dict}) return jsonify({"success": True, "printer": printer_dict, "message": "Drucker erfolgreich aktualisiert"})
except Exception as e: except Exception as e:
app_logger.error(f"❌ Admin API-Fehler beim Aktualisieren des Druckers {printer_id}: {str(e)}") app_logger.error(f"❌ Admin API-Fehler beim Aktualisieren des Druckers {printer_id}: {str(e)}")
return jsonify({"error": "Fehler beim Aktualisieren des Druckers", "details": str(e)}), 500 return jsonify({"success": False, "error": "Fehler beim Aktualisieren des Druckers", "details": str(e)}), 500
@app.route("/api/admin/printers/<int:printer_id>", methods=["DELETE"]) @app.route("/api/admin/printers/<int:printer_id>", methods=["DELETE"])
@login_required @login_required
@admin_required @admin_required
def api_admin_delete_printer(printer_id): def api_admin_delete_printer(printer_id):
"""API-Endpunkt für Drucker-Löschung (Admin only)""" """API-Endpunkt für Drucker-Löschung (Admin only)"""
try:
from models import get_db_session, Printer, Job
db_session = get_db_session()
printer = db_session.query(Printer).filter(Printer.id == printer_id).first()
if not printer:
db_session.close()
return jsonify({"error": "Drucker nicht gefunden"}), 404
# Prüfen ob der Drucker aktive Jobs hat
active_jobs = db_session.query(Job).filter(
Job.printer_id == printer_id,
Job.status.in_(["scheduled", "running"])
).count()
if active_jobs > 0:
db_session.close()
return jsonify({
"error": f"Drucker hat {active_jobs} aktive Jobs und kann nicht gelöscht werden",
"active_jobs": active_jobs
}), 409
printer_name = printer.name
db_session.delete(printer)
db_session.commit()
db_session.close()
app_logger.info(f"✅ Admin API: Drucker '{printer_name}' (ID: {printer_id}) gelöscht")
return jsonify({"success": True, "message": f"Drucker '{printer_name}' erfolgreich gelöscht"})
except Exception as e:
app_logger.error(f"❌ Admin API-Fehler beim Löschen des Druckers {printer_id}: {str(e)}")
return jsonify({"success": False, "error": "Fehler beim Löschen des Druckers", "details": str(e)}), 500
@app.route("/api/admin/printers/<int:printer_id>", methods=["GET"])
@login_required
@admin_required
def api_admin_get_printer(printer_id):
"""API-Endpunkt für einzelnen Drucker (Admin only)"""
try: try:
from models import get_db_session, Printer from models import get_db_session, Printer
@ -1673,17 +1749,81 @@ def api_admin_delete_printer(printer_id):
db_session.close() db_session.close()
return jsonify({"error": "Drucker nicht gefunden"}), 404 return jsonify({"error": "Drucker nicht gefunden"}), 404
printer_name = printer.name printer_dict = {
db_session.delete(printer) "id": printer.id,
db_session.commit() "name": printer.name,
"model": printer.model,
"location": printer.location,
"ip_address": printer.ip_address,
"mac_address": printer.mac_address,
"plug_ip": printer.plug_ip,
"plug_username": printer.plug_username, # Für Admin sichtbar
"status": printer.status,
"active": printer.active,
"created_at": printer.created_at.isoformat() if printer.created_at else None,
"updated_at": printer.updated_at.isoformat() if hasattr(printer, 'updated_at') and printer.updated_at else None,
"last_checked": printer.last_checked.isoformat() if printer.last_checked else None,
"has_plug": bool(printer.plug_ip), # Hilfreich für Frontend
"job_count": len(printer.jobs) if printer.jobs else 0
}
db_session.close() db_session.close()
app_logger.info(f"✅ Admin API: Drucker '{printer_name}' (ID: {printer_id}) gelöscht") app_logger.info(f"✅ Admin API: Drucker {printer_id} abgerufen")
return jsonify({"success": True, "message": "Drucker erfolgreich gelöscht"}) return jsonify({"success": True, "printer": printer_dict})
except Exception as e: except Exception as e:
app_logger.error(f"❌ Admin API-Fehler beim Löschen des Druckers {printer_id}: {str(e)}") app_logger.error(f"❌ Admin API-Fehler beim Abrufen des Druckers {printer_id}: {str(e)}")
return jsonify({"error": "Fehler beim Löschen des Druckers", "details": str(e)}), 500 return jsonify({"success": False, "error": "Fehler beim Laden des Druckers", "details": str(e)}), 500
@app.route("/api/admin/printers", methods=["GET"])
@login_required
@admin_required
def api_admin_get_printers():
"""API-Endpunkt für alle Drucker (Admin only)"""
try:
from models import get_db_session, Printer
db_session = get_db_session()
printers = db_session.query(Printer).all()
printer_list = []
for printer in printers:
printer_dict = {
"id": printer.id,
"name": printer.name,
"model": printer.model,
"location": printer.location,
"ip_address": printer.ip_address,
"mac_address": printer.mac_address,
"plug_ip": printer.plug_ip,
"status": printer.status,
"active": printer.active,
"created_at": printer.created_at.isoformat() if printer.created_at else None,
"last_checked": printer.last_checked.isoformat() if printer.last_checked else None,
"has_plug": bool(printer.plug_ip),
"job_count": len(printer.jobs) if printer.jobs else 0
}
printer_list.append(printer_dict)
db_session.close()
app_logger.info(f"✅ Admin API: {len(printer_list)} Drucker abgerufen")
return jsonify({
"success": True,
"printers": printer_list,
"count": len(printer_list)
})
except Exception as e:
app_logger.error(f"❌ Admin API-Fehler beim Abrufen der Drucker: {str(e)}")
return jsonify({
"success": False,
"error": "Fehler beim Laden der Drucker",
"details": str(e),
"printers": [],
"count": 0
}), 500
@app.route("/api/health", methods=["GET"]) @app.route("/api/health", methods=["GET"])
def api_health_check(): def api_health_check():

Binary file not shown.

Binary file not shown.

View File

@ -540,159 +540,16 @@ def delete_user_api(user_id):
return jsonify({"error": "Fehler beim Löschen des Benutzers"}), 500 return jsonify({"error": "Fehler beim Löschen des Benutzers"}), 500
# ===== DRUCKER-API-ROUTEN ===== # ===== DRUCKER-API-ROUTEN =====
# HINWEIS: Die Drucker-CRUD-Operationen wurden nach app.py verschoben
# für konsistente API-Responses und bessere Wartbarkeit.
# Verwenden Sie die folgenden Endpunkte:
# - GET /api/admin/printers - Alle Drucker abrufen
# - GET /api/admin/printers/<id> - Einzelnen Drucker abrufen
# - POST /api/admin/printers - Neuen Drucker erstellen
# - PUT /api/admin/printers/<id> - Drucker aktualisieren
# - DELETE /api/admin/printers/<id> - Drucker löschen
@admin_blueprint.route("/api/printers", methods=["POST"]) # Die alten Routen wurden entfernt, um Duplikate zu vermeiden
@admin_required
def create_printer_api():
"""Erstellt einen neuen Drucker über die API"""
try:
data = request.json
if not data:
return jsonify({"error": "Keine Daten empfangen"}), 400
# Pflichtfelder prüfen
required_fields = ["name", "location"]
for field in required_fields:
if field not in data or not data[field]:
return jsonify({"error": f"Feld '{field}' ist erforderlich"}), 400
with get_cached_session() as db_session:
# Prüfen ob Name bereits existiert
existing_printer = db_session.query(Printer).filter(Printer.name == data["name"]).first()
if existing_printer:
return jsonify({"error": "Ein Drucker mit diesem Namen existiert bereits"}), 400
# Neuen Drucker erstellen
printer = Printer(
name=data["name"],
location=data["location"],
model=data.get("model", ""),
ip_address=data.get("ip_address", ""),
api_key=data.get("api_key", ""),
plug_ip=data.get("plug_ip", ""),
plug_username=data.get("plug_username", ""),
plug_password=data.get("plug_password", ""),
status="offline"
)
db_session.add(printer)
db_session.commit()
db_session.refresh(printer)
admin_logger.info(f"Drucker {printer.name} erstellt von Admin {current_user.username}")
return jsonify({
"success": True,
"message": "Drucker erfolgreich erstellt",
"printer": printer.to_dict()
})
except Exception as e:
admin_logger.error(f"Fehler beim Erstellen des Druckers: {str(e)}")
return jsonify({"error": "Fehler beim Erstellen des Druckers"}), 500
@admin_blueprint.route("/api/printers/<int:printer_id>", methods=["GET"])
@admin_required
def get_printer_api(printer_id):
"""Gibt einen einzelnen Drucker zurück"""
try:
with get_cached_session() as db_session:
printer = db_session.query(Printer).filter(Printer.id == printer_id).first()
if not printer:
return jsonify({"error": "Drucker nicht gefunden"}), 404
return jsonify({
"success": True,
"printer": printer.to_dict()
})
except Exception as e:
admin_logger.error(f"Fehler beim Abrufen des Druckers: {str(e)}")
return jsonify({"error": "Fehler beim Abrufen des Druckers"}), 500
@admin_blueprint.route("/api/printers/<int:printer_id>", methods=["PUT"])
@admin_required
def update_printer_api(printer_id):
"""Aktualisiert einen Drucker über die API"""
try:
data = request.json
if not data:
return jsonify({"error": "Keine Daten empfangen"}), 400
with get_cached_session() as db_session:
printer = db_session.query(Printer).filter(Printer.id == printer_id).first()
if not printer:
return jsonify({"error": "Drucker nicht gefunden"}), 404
# Prüfen ob neuer Name bereits existiert (falls Name geändert wird)
if "name" in data and data["name"] != printer.name:
existing_printer = db_session.query(Printer).filter(
Printer.name == data["name"],
Printer.id != printer_id
).first()
if existing_printer:
return jsonify({"error": "Ein Drucker mit diesem Namen existiert bereits"}), 400
# Drucker-Eigenschaften aktualisieren
updateable_fields = ["name", "location", "model", "ip_address", "api_key",
"plug_ip", "plug_username", "plug_password"]
for field in updateable_fields:
if field in data:
setattr(printer, field, data[field])
db_session.commit()
admin_logger.info(f"Drucker {printer.name} aktualisiert von Admin {current_user.username}")
return jsonify({
"success": True,
"message": "Drucker erfolgreich aktualisiert",
"printer": printer.to_dict()
})
except Exception as e:
admin_logger.error(f"Fehler beim Aktualisieren des Druckers: {str(e)}")
return jsonify({"error": "Fehler beim Aktualisieren des Druckers"}), 500
@admin_blueprint.route("/api/printers/<int:printer_id>", methods=["DELETE"])
@admin_required
def delete_printer_api(printer_id):
"""Löscht einen Drucker über die API"""
try:
with get_cached_session() as db_session:
printer = db_session.query(Printer).filter(Printer.id == printer_id).first()
if not printer:
return jsonify({"error": "Drucker nicht gefunden"}), 404
# Prüfen ob noch aktive Jobs für diesen Drucker existieren
active_jobs = db_session.query(Job).filter(
Job.printer_id == printer_id,
Job.status.in_(['pending', 'printing', 'paused'])
).count()
if active_jobs > 0:
return jsonify({
"error": f"Drucker kann nicht gelöscht werden. Es gibt noch {active_jobs} aktive Job(s)"
}), 400
printer_name = printer.name
db_session.delete(printer)
db_session.commit()
admin_logger.info(f"Drucker {printer_name} gelöscht von Admin {current_user.username}")
return jsonify({
"success": True,
"message": "Drucker erfolgreich gelöscht"
})
except Exception as e:
admin_logger.error(f"Fehler beim Löschen des Druckers: {str(e)}")
return jsonify({"error": "Fehler beim Löschen des Druckers"}), 500
# ===== ERWEITERTE SYSTEM-API (ursprünglich admin_api.py) ===== # ===== ERWEITERTE SYSTEM-API (ursprünglich admin_api.py) =====

View File

@ -1415,3 +1415,186 @@ werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'admin.
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates - C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\base.html') -> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\base.html')
2025-06-12 08:12:36 - [app] app - [DEBUG] DEBUG - Response: 200 2025-06-12 08:12:36 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:52 - [app] app - [WARNING] WARNING - DatabaseCleanupManager nicht verfügbar - Fallback auf Legacy-Cleanup
2025-06-12 08:20:52 - [app] app - [INFO] INFO - Optimierte SQLite-Engine erstellt: backend/database/myp.db
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [CONFIG] Erkannte Umgebung: development
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [CONFIG] Production-Modus: False
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [CONFIG] Verwende Development-Konfiguration
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [DEVELOPMENT] Aktiviere Development-Konfiguration
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ MYP Development Environment Konfiguration aktiviert
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ Environment: Development/Testing
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ Debug Mode: True
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ SQL Echo: True
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] 🚀 Starte MYP DEVELOPMENT-Umgebung
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] 🏢 Mercedes-Benz TBA Marienfelde
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] 🔒 Air-Gapped: True
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] Initialisiere Datenbank...
2025-06-12 08:20:53 - [app] app - [INFO] INFO - SQLite für Raspberry Pi optimiert (reduzierte Cache-Größe, SD-Karten I/O)
2025-06-12 08:20:53 - [app] app - [INFO] INFO - Datenbank mit Optimierungen initialisiert
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] ✅ Datenbank initialisiert
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] Prüfe Initial-Admin...
2025-06-12 08:20:53 - [app] app - [INFO] INFO - Admin-Benutzer admin (admin@mercedes-benz.com) existiert bereits. Passwort wurde zurückgesetzt.
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] ✅ Admin-Benutzer geprüft
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] Starte Queue Manager...
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] ✅ Queue Manager gestartet
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] Starte Job Scheduler...
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] ✅ Job Scheduler gestartet
2025-06-12 08:20:53 - [app] app - [INFO] INFO - [STARTUP] 🌐 Server startet auf http://0.0.0.0:5000
2025-06-12 08:20:54 - [app] app - [WARNING] WARNING - DatabaseCleanupManager nicht verfügbar - Fallback auf Legacy-Cleanup
2025-06-12 08:20:54 - [app] app - [INFO] INFO - Optimierte SQLite-Engine erstellt: backend/database/myp.db
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [CONFIG] Erkannte Umgebung: development
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [CONFIG] Production-Modus: False
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [CONFIG] Verwende Development-Konfiguration
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [DEVELOPMENT] Aktiviere Development-Konfiguration
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ MYP Development Environment Konfiguration aktiviert
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ Environment: Development/Testing
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ Debug Mode: True
2025-06-12 08:20:55 - [app] app - [INFO] INFO - [DEVELOPMENT] ✅ SQL Echo: True
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] 🚀 Starte MYP DEVELOPMENT-Umgebung
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] 🏢 Mercedes-Benz TBA Marienfelde
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] 🔒 Air-Gapped: True
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] Initialisiere Datenbank...
2025-06-12 08:20:56 - [app] app - [INFO] INFO - SQLite für Raspberry Pi optimiert (reduzierte Cache-Größe, SD-Karten I/O)
2025-06-12 08:20:56 - [app] app - [INFO] INFO - Datenbank mit Optimierungen initialisiert
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] ✅ Datenbank initialisiert
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] Prüfe Initial-Admin...
2025-06-12 08:20:56 - [app] app - [INFO] INFO - Admin-Benutzer admin (admin@mercedes-benz.com) existiert bereits. Passwort wurde zurückgesetzt.
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] ✅ Admin-Benutzer geprüft
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] Starte Queue Manager...
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] ✅ Queue Manager gestartet
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] Starte Job Scheduler...
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] ✅ Job Scheduler gestartet
2025-06-12 08:20:56 - [app] app - [INFO] INFO - [STARTUP] 🌐 Server startet auf http://0.0.0.0:5000
2025-06-12 08:20:56 - [app] app - [INFO] INFO - Locating template 'dashboard.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\dashboard.html')
2025-06-12 08:20:56 - [app] app - [INFO] INFO - Locating template 'base.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\base.html')
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /api/printers/monitor/live-status
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /api/session/status
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /api/user/settings
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 500
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Request: GET /dashboard
2025-06-12 08:20:56 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Request: GET /tapo/
2025-06-12 08:20:57 - [app] app - [INFO] INFO - Locating template 'tapo_control.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\tapo_control.html')
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Request: GET /api/session/status
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Request: GET /api/user/settings
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:57 - [app] app - [DEBUG] DEBUG - Response: 500
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /jobs
2025-06-12 08:20:59 - [app] app - [INFO] INFO - Locating template 'jobs.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\jobs.html')
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /api/jobs
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /api/session/status
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /api/user/settings
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /api/printers
2025-06-12 08:20:59 - [app] app - [INFO] INFO - ✅ API: 0 Drucker abgerufen
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Request: GET /dashboard
2025-06-12 08:20:59 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:04 - [app] app - [DEBUG] DEBUG - Request: GET /.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:04 - [app] app - [INFO] INFO - Not Found (404): http://127.0.0.1:5000/.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:04 - [app] app - [INFO] INFO - Locating template 'errors/404.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\errors\\404.html')
2025-06-12 08:21:04 - [app] app - [DEBUG] DEBUG - Response: 404
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Request: GET /api/jobs
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Request: GET /auth/logout
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:14 - [app] app - [INFO] INFO - Locating template 'login.html':
1: trying loader of application '__main__'
class: jinja2.loaders.FileSystemLoader
encoding: 'utf-8'
followlinks: False
searchpath:
- C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend\templates
-> found ('C:\\Users\\TTOMCZA.EMEA\\Dev\\Projektarbeit-MYP\\backend\\templates\\login.html')
2025-06-12 08:21:14 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /api/jobs
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /api/jobs
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:29 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Request: GET /.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:37 - [app] app - [INFO] INFO - Not Found (404): http://127.0.0.1:5000/.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Response: 404
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Request: GET /.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:37 - [app] app - [INFO] INFO - Not Found (404): http://127.0.0.1:5000/.well-known/appspecific/com.chrome.devtools.json
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Response: 404
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:37 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:21:57 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:21:57 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:21:57 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:21:57 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:22:27 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:22:27 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:22:27 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:22:27 - [app] app - [DEBUG] DEBUG - Response: 200
2025-06-12 08:22:57 - [app] app - [DEBUG] DEBUG - Request: GET /api/notifications
2025-06-12 08:22:57 - [app] app - [DEBUG] DEBUG - Response: 302
2025-06-12 08:22:57 - [app] app - [DEBUG] DEBUG - Request: GET /auth/login
2025-06-12 08:22:57 - [app] app - [DEBUG] DEBUG - Response: 200

View File

@ -31,3 +31,4 @@ WHERE users.username = ? OR users.email = ?
2025-06-12 08:02:26 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich erfolgreich angemeldet 2025-06-12 08:02:26 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich erfolgreich angemeldet
2025-06-12 08:08:22 - [auth] auth - [WARNING] WARNING - JSON-Parsing fehlgeschlagen: 400 Bad Request: Failed to decode JSON object: Expecting value: line 1 column 1 (char 0) 2025-06-12 08:08:22 - [auth] auth - [WARNING] WARNING - JSON-Parsing fehlgeschlagen: 400 Bad Request: Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)
2025-06-12 08:08:22 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich erfolgreich angemeldet 2025-06-12 08:08:22 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich erfolgreich angemeldet
2025-06-12 08:21:14 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich abgemeldet

View File

@ -26,3 +26,7 @@
2025-06-12 08:10:59 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion) 2025-06-12 08:10:59 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion)
2025-06-12 08:11:56 - [core_system] core_system - [INFO] INFO - ✅ Core System Management Module erfolgreich initialisiert 2025-06-12 08:11:56 - [core_system] core_system - [INFO] INFO - ✅ Core System Management Module erfolgreich initialisiert
2025-06-12 08:11:56 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion) 2025-06-12 08:11:56 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion)
2025-06-12 08:20:51 - [core_system] core_system - [INFO] INFO - ✅ Core System Management Module erfolgreich initialisiert
2025-06-12 08:20:51 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion)
2025-06-12 08:20:54 - [core_system] core_system - [INFO] INFO - ✅ Core System Management Module erfolgreich initialisiert
2025-06-12 08:20:54 - [core_system] core_system - [INFO] INFO - 📊 Massive Konsolidierung: 6 Dateien → 1 Datei (88% Reduktion)

View File

@ -26,3 +26,7 @@
2025-06-12 08:10:59 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion) 2025-06-12 08:10:59 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:11:56 - [data_management] data_management - [INFO] INFO - ✅ Data Management Module initialisiert 2025-06-12 08:11:56 - [data_management] data_management - [INFO] INFO - ✅ Data Management Module initialisiert
2025-06-12 08:11:56 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion) 2025-06-12 08:11:56 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:52 - [data_management] data_management - [INFO] INFO - ✅ Data Management Module initialisiert
2025-06-12 08:20:52 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:54 - [data_management] data_management - [INFO] INFO - ✅ Data Management Module initialisiert
2025-06-12 08:20:54 - [data_management] data_management - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)

View File

@ -54,3 +54,11 @@
2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Printer Monitor initialisiert 2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Printer Monitor initialisiert
2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Hardware Integration Module initialisiert 2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Hardware Integration Module initialisiert
2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - 📊 Massive Konsolidierung: 2 Dateien → 1 Datei (50% Reduktion) 2025-06-12 08:11:56 - [hardware_integration] hardware_integration - [INFO] INFO - 📊 Massive Konsolidierung: 2 Dateien → 1 Datei (50% Reduktion)
2025-06-12 08:20:52 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ PyP100 (TP-Link Tapo) verfügbar
2025-06-12 08:20:52 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Printer Monitor initialisiert
2025-06-12 08:20:52 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Hardware Integration Module initialisiert
2025-06-12 08:20:52 - [hardware_integration] hardware_integration - [INFO] INFO - 📊 Massive Konsolidierung: 2 Dateien → 1 Datei (50% Reduktion)
2025-06-12 08:20:54 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ PyP100 (TP-Link Tapo) verfügbar
2025-06-12 08:20:54 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Printer Monitor initialisiert
2025-06-12 08:20:54 - [hardware_integration] hardware_integration - [INFO] INFO - ✅ Hardware Integration Module initialisiert
2025-06-12 08:20:54 - [hardware_integration] hardware_integration - [INFO] INFO - 📊 Massive Konsolidierung: 2 Dateien → 1 Datei (50% Reduktion)

View File

@ -53,3 +53,11 @@
2025-06-12 08:11:57 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestartet (Legacy-Kompatibilität) 2025-06-12 08:11:57 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestartet (Legacy-Kompatibilität)
2025-06-12 08:13:03 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität) 2025-06-12 08:13:03 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität)
2025-06-12 08:13:03 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität) 2025-06-12 08:13:03 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität)
2025-06-12 08:20:52 - [job_queue_system] job_queue_system - [INFO] INFO - ✅ Job & Queue System Module initialisiert
2025-06-12 08:20:52 - [job_queue_system] job_queue_system - [INFO] INFO - 📊 MASSIVE Konsolidierung: 4 Dateien → 1 Datei (75% Reduktion)
2025-06-12 08:20:53 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestartet (Legacy-Kompatibilität)
2025-06-12 08:20:54 - [job_queue_system] job_queue_system - [INFO] INFO - ✅ Job & Queue System Module initialisiert
2025-06-12 08:20:54 - [job_queue_system] job_queue_system - [INFO] INFO - 📊 MASSIVE Konsolidierung: 4 Dateien → 1 Datei (75% Reduktion)
2025-06-12 08:20:56 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestartet (Legacy-Kompatibilität)
2025-06-12 08:23:05 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität)
2025-06-12 08:23:05 - [job_queue_system] job_queue_system - [INFO] INFO - Queue Manager gestoppt (Legacy-Kompatibilität)

View File

@ -51,3 +51,7 @@ TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
2025-06-12 08:12:21 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1) 2025-06-12 08:12:21 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1)
2025-06-12 08:12:36 - [jobs] jobs - [INFO] INFO - 📋 Jobs-Abfrage gestartet von Benutzer 1 (Admin: True) 2025-06-12 08:12:36 - [jobs] jobs - [INFO] INFO - 📋 Jobs-Abfrage gestartet von Benutzer 1 (Admin: True)
2025-06-12 08:12:36 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1) 2025-06-12 08:12:36 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1)
2025-06-12 08:20:59 - [jobs] jobs - [INFO] INFO - 📋 Jobs-Abfrage gestartet von Benutzer 1 (Admin: True)
2025-06-12 08:20:59 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1)
2025-06-12 08:21:14 - [jobs] jobs - [INFO] INFO - 📋 Jobs-Abfrage gestartet von Benutzer 1 (Admin: True)
2025-06-12 08:21:14 - [jobs] jobs - [INFO] INFO - ✅ Jobs erfolgreich abgerufen: 0 von 0 (Seite 1)

View File

@ -0,0 +1,15 @@
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ============================================================
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - MYP Datenbank-Migration - Drucker-Schema-Update
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ============================================================
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ✅ Datenbank-Backup erstellt: backend/database/myp_backup_20250612_082036.db
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - 🚀 Starte Drucker-Tabellen-Migration...
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - Füge updated_at Spalte hinzu...
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ✅ updated_at Spalte hinzugefügt
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - 🔄 Erstelle neue Drucker-Tabelle mit aktualisierten Schema...
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - 📋 Kopiere Daten in neue Tabelle...
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ✅ Migration erfolgreich abgeschlossen!
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - 📊 Statistiken:
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - - Gesamt Drucker: 0
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - - Drucker mit Steckdose: 0
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - ✅ Migration erfolgreich abgeschlossen!
2025-06-12 08:20:36 - [migration] migration - [INFO] INFO - Backup verfügbar unter: backend/database/myp_backup_20250612_082036.db

View File

@ -26,3 +26,7 @@
2025-06-12 08:11:00 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion) 2025-06-12 08:11:00 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:11:57 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - ✅ Monitoring & Analytics Module initialisiert 2025-06-12 08:11:57 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - ✅ Monitoring & Analytics Module initialisiert
2025-06-12 08:11:57 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion) 2025-06-12 08:11:57 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:53 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - ✅ Monitoring & Analytics Module initialisiert
2025-06-12 08:20:53 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:55 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - ✅ Monitoring & Analytics Module initialisiert
2025-06-12 08:20:55 - [monitoring_analytics] monitoring_analytics - [INFO] INFO - 📊 MASSIVE Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)

View File

@ -4,3 +4,6 @@
2025-06-12 08:08:27 - [printers] printers - [INFO] INFO - 🔄 Live-Status-Abfrage von Benutzer Administrator (ID: 1) 2025-06-12 08:08:27 - [printers] printers - [INFO] INFO - 🔄 Live-Status-Abfrage von Benutzer Administrator (ID: 1)
2025-06-12 08:08:27 - [printers] printers - [ERROR] ERROR - ❌ Fehler bei Live-Status-Abfrage: PrinterMonitor.get_live_printer_status() got an unexpected keyword argument 'use_session_cache' 2025-06-12 08:08:27 - [printers] printers - [ERROR] ERROR - ❌ Fehler bei Live-Status-Abfrage: PrinterMonitor.get_live_printer_status() got an unexpected keyword argument 'use_session_cache'
2025-06-12 08:08:27 - [printers] printers - [INFO] INFO - [OK] API-Live-Drucker-Status-Abfrage 'get_live_printer_status' erfolgreich in 9.79ms 2025-06-12 08:08:27 - [printers] printers - [INFO] INFO - [OK] API-Live-Drucker-Status-Abfrage 'get_live_printer_status' erfolgreich in 9.79ms
2025-06-12 08:20:56 - [printers] printers - [INFO] INFO - 🔄 Live-Status-Abfrage von Benutzer Administrator (ID: 1)
2025-06-12 08:20:56 - [printers] printers - [ERROR] ERROR - ❌ Fehler bei Live-Status-Abfrage: PrinterMonitor.get_live_printer_status() got an unexpected keyword argument 'use_session_cache'
2025-06-12 08:20:56 - [printers] printers - [INFO] INFO - [OK] API-Live-Drucker-Status-Abfrage 'get_live_printer_status' erfolgreich in 0.74ms

View File

@ -38,3 +38,9 @@
2025-06-12 08:11:56 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True 2025-06-12 08:11:56 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True
2025-06-12 08:11:57 - [scheduler] scheduler - [INFO] INFO - Scheduler-Thread gestartet 2025-06-12 08:11:57 - [scheduler] scheduler - [INFO] INFO - Scheduler-Thread gestartet
2025-06-12 08:11:57 - [scheduler] scheduler - [INFO] INFO - Scheduler gestartet 2025-06-12 08:11:57 - [scheduler] scheduler - [INFO] INFO - Scheduler gestartet
2025-06-12 08:20:52 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True
2025-06-12 08:20:53 - [scheduler] scheduler - [INFO] INFO - Scheduler-Thread gestartet
2025-06-12 08:20:53 - [scheduler] scheduler - [INFO] INFO - Scheduler gestartet
2025-06-12 08:20:54 - [scheduler] scheduler - [INFO] INFO - Task check_jobs registriert: Intervall 30s, Enabled: True
2025-06-12 08:20:56 - [scheduler] scheduler - [INFO] INFO - Scheduler-Thread gestartet
2025-06-12 08:20:56 - [scheduler] scheduler - [INFO] INFO - Scheduler gestartet

View File

@ -40,3 +40,9 @@
2025-06-12 08:11:56 - [security_suite] security_suite - [INFO] INFO - ✅ Security Suite Module initialisiert 2025-06-12 08:11:56 - [security_suite] security_suite - [INFO] INFO - ✅ Security Suite Module initialisiert
2025-06-12 08:11:56 - [security_suite] security_suite - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion) 2025-06-12 08:11:56 - [security_suite] security_suite - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:11:57 - [security_suite] security_suite - [INFO] INFO - 🔒 Security Suite initialisiert 2025-06-12 08:11:57 - [security_suite] security_suite - [INFO] INFO - 🔒 Security Suite initialisiert
2025-06-12 08:20:52 - [security_suite] security_suite - [INFO] INFO - ✅ Security Suite Module initialisiert
2025-06-12 08:20:52 - [security_suite] security_suite - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:53 - [security_suite] security_suite - [INFO] INFO - 🔒 Security Suite initialisiert
2025-06-12 08:20:54 - [security_suite] security_suite - [INFO] INFO - ✅ Security Suite Module initialisiert
2025-06-12 08:20:54 - [security_suite] security_suite - [INFO] INFO - 📊 Massive Konsolidierung: 3 Dateien → 1 Datei (67% Reduktion)
2025-06-12 08:20:56 - [security_suite] security_suite - [INFO] INFO - 🔒 Security Suite initialisiert

View File

@ -3,3 +3,4 @@
2025-06-12 08:08:29 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds' 2025-06-12 08:08:29 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds'
2025-06-12 08:11:02 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds' 2025-06-12 08:11:02 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds'
2025-06-12 08:11:06 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds' 2025-06-12 08:11:06 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds'
2025-06-12 08:20:57 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds'

View File

@ -124,3 +124,21 @@
2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert 2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert
2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert 2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert
2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - ================================================== 2025-06-12 08:11:57 - [startup] startup - [INFO] INFO - ==================================================
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - ==================================================
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - [START] MYP Platform Backend wird gestartet...
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - 🐍 Python Version: 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)]
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - 💻 Betriebssystem: nt (win32)
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - 📁 Arbeitsverzeichnis: C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - ⏰ Startzeit: 2025-06-12T08:20:53.214253
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert
2025-06-12 08:20:53 - [startup] startup - [INFO] INFO - ==================================================
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - ==================================================
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - [START] MYP Platform Backend wird gestartet...
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - 🐍 Python Version: 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)]
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - 💻 Betriebssystem: nt (win32)
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - 📁 Arbeitsverzeichnis: C:\Users\TTOMCZA.EMEA\Dev\Projektarbeit-MYP\backend
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - ⏰ Startzeit: 2025-06-12T08:20:55.953656
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - 🪟 Windows-Modus: Aktiviert
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - 🔒 Windows-sichere Log-Rotation: Aktiviert
2025-06-12 08:20:55 - [startup] startup - [INFO] INFO - ==================================================

View File

@ -3,3 +3,5 @@
2025-06-12 08:08:29 - [tapo_control] tapo_control - [ERROR] ERROR - Fehler beim Laden des Tapo-Dashboards: Could not build url for endpoint 'admin.manage_printers'. Did you mean 'admin.get_printer_api' instead? 2025-06-12 08:08:29 - [tapo_control] tapo_control - [ERROR] ERROR - Fehler beim Laden des Tapo-Dashboards: Could not build url for endpoint 'admin.manage_printers'. Did you mean 'admin.get_printer_api' instead?
2025-06-12 08:11:02 - [tapo_control] tapo_control - [INFO] INFO - Tapo Dashboard aufgerufen von Benutzer: Administrator 2025-06-12 08:11:02 - [tapo_control] tapo_control - [INFO] INFO - Tapo Dashboard aufgerufen von Benutzer: Administrator
2025-06-12 08:11:02 - [tapo_control] tapo_control - [INFO] INFO - Dashboard geladen: 0 Steckdosen, 0 online 2025-06-12 08:11:02 - [tapo_control] tapo_control - [INFO] INFO - Dashboard geladen: 0 Steckdosen, 0 online
2025-06-12 08:20:57 - [tapo_control] tapo_control - [INFO] INFO - Tapo Dashboard aufgerufen von Benutzer: Administrator
2025-06-12 08:20:57 - [tapo_control] tapo_control - [INFO] INFO - Dashboard geladen: 0 Steckdosen, 0 online

View File

@ -12,3 +12,5 @@
2025-06-12 08:10:57 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert 2025-06-12 08:10:57 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert
2025-06-12 08:10:59 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert 2025-06-12 08:10:59 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert
2025-06-12 08:11:56 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert 2025-06-12 08:11:56 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert
2025-06-12 08:20:52 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert
2025-06-12 08:20:54 - [tapo_controller] tapo_controller - [INFO] INFO - ✅ tapo controller initialisiert

View File

@ -3,3 +3,6 @@
2025-06-12 08:08:29 - [user] user - [INFO] INFO - User admin retrieved settings via API 2025-06-12 08:08:29 - [user] user - [INFO] INFO - User admin retrieved settings via API
2025-06-12 08:11:02 - [user] user - [INFO] INFO - User admin retrieved settings via API 2025-06-12 08:11:02 - [user] user - [INFO] INFO - User admin retrieved settings via API
2025-06-12 08:11:06 - [user] user - [INFO] INFO - User admin retrieved settings via API 2025-06-12 08:11:06 - [user] user - [INFO] INFO - User admin retrieved settings via API
2025-06-12 08:20:56 - [user] user - [INFO] INFO - User admin retrieved settings via API
2025-06-12 08:20:57 - [user] user - [INFO] INFO - User admin retrieved settings via API
2025-06-12 08:20:59 - [user] user - [INFO] INFO - User admin retrieved settings via API

View File

@ -26,3 +26,9 @@
2025-06-12 08:10:59 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion) 2025-06-12 08:10:59 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion)
2025-06-12 08:11:56 - [utilities_collection] utilities_collection - [INFO] INFO - ✅ Utilities Collection initialisiert 2025-06-12 08:11:56 - [utilities_collection] utilities_collection - [INFO] INFO - ✅ Utilities Collection initialisiert
2025-06-12 08:11:56 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion) 2025-06-12 08:11:56 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion)
2025-06-12 08:20:36 - [utilities_collection] utilities_collection - [INFO] INFO - ✅ Utilities Collection initialisiert
2025-06-12 08:20:36 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion)
2025-06-12 08:20:52 - [utilities_collection] utilities_collection - [INFO] INFO - ✅ Utilities Collection initialisiert
2025-06-12 08:20:52 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion)
2025-06-12 08:20:54 - [utilities_collection] utilities_collection - [INFO] INFO - ✅ Utilities Collection initialisiert
2025-06-12 08:20:54 - [utilities_collection] utilities_collection - [INFO] INFO - 🚨 ALLERLETZTE MEGA-Konsolidierung: 12+ Dateien → 1 Datei (90%+ Reduktion)

View File

@ -26,3 +26,7 @@
2025-06-12 08:10:59 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet 2025-06-12 08:10:59 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet
2025-06-12 08:11:56 - [windows_fixes] windows_fixes - [INFO] INFO - 🔧 Wende Windows-spezifische Fixes an... 2025-06-12 08:11:56 - [windows_fixes] windows_fixes - [INFO] INFO - 🔧 Wende Windows-spezifische Fixes an...
2025-06-12 08:11:56 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet 2025-06-12 08:11:56 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet
2025-06-12 08:20:51 - [windows_fixes] windows_fixes - [INFO] INFO - 🔧 Wende Windows-spezifische Fixes an...
2025-06-12 08:20:51 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet
2025-06-12 08:20:54 - [windows_fixes] windows_fixes - [INFO] INFO - 🔧 Wende Windows-spezifische Fixes an...
2025-06-12 08:20:54 - [windows_fixes] windows_fixes - [INFO] INFO - ✅ Alle Windows-Fixes erfolgreich angewendet

View File

@ -529,14 +529,15 @@ class Printer(Base):
model = Column(String(100)) # Drucker-Modell model = Column(String(100)) # Drucker-Modell
location = Column(String(100)) location = Column(String(100))
ip_address = Column(String(50)) # IP-Adresse des Druckers ip_address = Column(String(50)) # IP-Adresse des Druckers
mac_address = Column(String(50), nullable=False, unique=True) mac_address = Column(String(50), nullable=True, unique=True) # Jetzt nullable
plug_ip = Column(String(50), nullable=False) plug_ip = Column(String(50), nullable=True) # Jetzt nullable
plug_username = Column(String(100), nullable=False) plug_username = Column(String(100), nullable=True) # Jetzt nullable
plug_password = Column(String(100), nullable=False) plug_password = Column(String(100), nullable=True) # Jetzt nullable
status = Column(String(20), default="offline") # online, offline, busy, idle status = Column(String(20), default="offline") # online, offline, busy, idle
active = Column(Boolean, default=True) active = Column(Boolean, default=True)
created_at = Column(DateTime, default=datetime.now) created_at = Column(DateTime, default=datetime.now)
last_checked = Column(DateTime, nullable=True) # Zeitstempel der letzten Status-Überprüfung last_checked = Column(DateTime, nullable=True) # Zeitstempel der letzten Status-Überprüfung
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now) # Für Update-Tracking
jobs = relationship("Job", back_populates="printer", cascade="all, delete-orphan") jobs = relationship("Job", back_populates="printer", cascade="all, delete-orphan")

View File

@ -0,0 +1,188 @@
#!/usr/bin/env python3
"""
Datenbank-Migrationsskript für MYP - Drucker-Schema-Update
Dieses Skript aktualisiert das Drucker-Schema, um die Tapo-Felder
und MAC-Adresse als nullable zu machen.
"""
import os
import sys
import sqlite3
from datetime import datetime
# Pfad zu backend hinzufügen
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from utils.logging_config import get_logger
from utils.utilities_collection import DATABASE_PATH
logger = get_logger("migration")
def backup_database():
"""Erstellt ein Backup der Datenbank vor der Migration"""
try:
backup_path = DATABASE_PATH.replace('.db', f'_backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}.db')
# Kopiere die Datenbank
import shutil
shutil.copy2(DATABASE_PATH, backup_path)
logger.info(f"✅ Datenbank-Backup erstellt: {backup_path}")
return backup_path
except Exception as e:
logger.error(f"❌ Fehler beim Erstellen des Backups: {e}")
raise
def check_column_nullable(conn, table_name, column_name):
"""Überprüft, ob eine Spalte nullable ist"""
cursor = conn.cursor()
cursor.execute(f"PRAGMA table_info({table_name})")
columns = cursor.fetchall()
for column in columns:
if column[1] == column_name:
# column[3] ist 1 wenn NOT NULL, 0 wenn nullable
return column[3] == 0
return None
def migrate_printers_table():
"""Führt die Migration der Drucker-Tabelle durch"""
logger.info("🚀 Starte Drucker-Tabellen-Migration...")
try:
# Verbindung zur Datenbank
conn = sqlite3.connect(DATABASE_PATH)
cursor = conn.cursor()
# Prüfe, ob die Spalten existieren
cursor.execute("PRAGMA table_info(printers)")
columns = {col[1]: col for col in cursor.fetchall()}
# Prüfe, ob updated_at Spalte existiert
if 'updated_at' not in columns:
logger.info(" Füge updated_at Spalte hinzu...")
cursor.execute("""
ALTER TABLE printers
ADD COLUMN updated_at TIMESTAMP
""")
# Setze initialen Wert
cursor.execute("""
UPDATE printers
SET updated_at = created_at
WHERE updated_at IS NULL
""")
logger.info("✅ updated_at Spalte hinzugefügt")
# SQLite unterstützt kein direktes ALTER COLUMN für NOT NULL Änderungen
# Wir müssen die Tabelle neu erstellen
# Prüfe ob Migration notwendig ist
mac_nullable = check_column_nullable(conn, 'printers', 'mac_address')
plug_ip_nullable = check_column_nullable(conn, 'printers', 'plug_ip')
if mac_nullable and plug_ip_nullable:
logger.info(" Migration bereits durchgeführt - keine Änderungen notwendig")
conn.close()
return
logger.info("🔄 Erstelle neue Drucker-Tabelle mit aktualisierten Schema...")
# Temporäre Tabelle mit neuem Schema erstellen
cursor.execute("""
CREATE TABLE IF NOT EXISTS printers_new (
id INTEGER PRIMARY KEY,
name VARCHAR(100) NOT NULL,
model VARCHAR(100),
location VARCHAR(100),
ip_address VARCHAR(50),
mac_address VARCHAR(50) UNIQUE,
plug_ip VARCHAR(50),
plug_username VARCHAR(100),
plug_password VARCHAR(100),
status VARCHAR(20) DEFAULT 'offline',
active BOOLEAN DEFAULT 1,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_checked TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")
# Daten kopieren
logger.info("📋 Kopiere Daten in neue Tabelle...")
cursor.execute("""
INSERT INTO printers_new
SELECT
id, name, model, location, ip_address, mac_address,
plug_ip, plug_username, plug_password, status, active,
created_at, last_checked,
COALESCE(updated_at, created_at) as updated_at
FROM printers
""")
# Alte Tabelle löschen und neue umbenennen
cursor.execute("DROP TABLE printers")
cursor.execute("ALTER TABLE printers_new RENAME TO printers")
# Generiere MAC-Adressen für Drucker ohne MAC
cursor.execute("SELECT id, name FROM printers WHERE mac_address IS NULL OR mac_address = ''")
printers_without_mac = cursor.fetchall()
if printers_without_mac:
logger.info(f"🔧 Generiere MAC-Adressen für {len(printers_without_mac)} Drucker...")
import uuid
for printer_id, printer_name in printers_without_mac:
# Generiere eindeutige MAC-Adresse
mac = "00:50:56:" + ":".join([f"{uuid.uuid4().hex[:2]}" for _ in range(3)])
cursor.execute(
"UPDATE printers SET mac_address = ? WHERE id = ?",
(mac, printer_id)
)
logger.info(f"{printer_name}: {mac}")
# Änderungen committen
conn.commit()
logger.info("✅ Migration erfolgreich abgeschlossen!")
# Statistiken anzeigen
cursor.execute("SELECT COUNT(*) FROM printers")
total_printers = cursor.fetchone()[0]
cursor.execute("SELECT COUNT(*) FROM printers WHERE plug_ip IS NOT NULL")
printers_with_plug = cursor.fetchone()[0]
logger.info(f"📊 Statistiken:")
logger.info(f" - Gesamt Drucker: {total_printers}")
logger.info(f" - Drucker mit Steckdose: {printers_with_plug}")
conn.close()
except Exception as e:
logger.error(f"❌ Fehler bei der Migration: {e}")
raise
def main():
"""Hauptfunktion für die Migration"""
logger.info("=" * 60)
logger.info("MYP Datenbank-Migration - Drucker-Schema-Update")
logger.info("=" * 60)
try:
# Backup erstellen
backup_path = backup_database()
# Migration durchführen
migrate_printers_table()
logger.info("✅ Migration erfolgreich abgeschlossen!")
logger.info(f" Backup verfügbar unter: {backup_path}")
except Exception as e:
logger.error(f"❌ Migration fehlgeschlagen: {e}")
logger.error(" Bitte Backup wiederherstellen und Fehler beheben")
sys.exit(1)
if __name__ == "__main__":
main()

Some files were not shown because too many files have changed in this diff Show More