diff --git a/backend/__pycache__/models.cpython-313.pyc b/backend/__pycache__/models.cpython-313.pyc index 097f137e4..10d43856c 100644 Binary files a/backend/__pycache__/models.cpython-313.pyc and b/backend/__pycache__/models.cpython-313.pyc differ diff --git a/backend/app.py b/backend/app.py index a64b28f16..5c1f4dee4 100644 --- a/backend/app.py +++ b/backend/app.py @@ -20,6 +20,7 @@ from flask_wtf.csrf import CSRFError from sqlalchemy import event from contextlib import contextmanager import threading +import uuid # ===== MINIMALE SESSION-DATENKLASSE ===== class MinimalSessionInterface: @@ -1563,12 +1564,25 @@ def api_admin_create_printer(): 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 new_printer = Printer( name=data["name"], model=data["model"], location=data.get("location", ""), ip_address=data.get("ip_address"), + mac_address=mac_address, plug_ip=data.get("plug_ip"), plug_username=data.get("plug_username"), plug_password=data.get("plug_password"), @@ -1584,18 +1598,22 @@ def api_admin_create_printer(): "name": new_printer.name, "model": new_printer.model, "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, - "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() 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: 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/", methods=["PUT"]) @login_required @@ -1616,6 +1634,16 @@ def api_admin_update_printer(printer_id): db_session.close() 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 if "name" in data: printer.name = data["name"] @@ -1625,6 +1653,8 @@ def api_admin_update_printer(printer_id): printer.location = data["location"] if "ip_address" in data: printer.ip_address = data["ip_address"] + if "mac_address" in data: + printer.mac_address = data["mac_address"] if "plug_ip" in data: printer.plug_ip = data["plug_ip"] if "plug_username" in data: @@ -1645,24 +1675,70 @@ def api_admin_update_printer(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 + "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() 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: 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/", methods=["DELETE"]) @login_required @admin_required def api_admin_delete_printer(printer_id): """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/", methods=["GET"]) +@login_required +@admin_required +def api_admin_get_printer(printer_id): + """API-Endpunkt für einzelnen Drucker (Admin only)""" try: from models import get_db_session, Printer @@ -1673,17 +1749,81 @@ def api_admin_delete_printer(printer_id): db_session.close() return jsonify({"error": "Drucker nicht gefunden"}), 404 - printer_name = printer.name - db_session.delete(printer) - db_session.commit() + 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, + "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() - app_logger.info(f"✅ Admin API: Drucker '{printer_name}' (ID: {printer_id}) gelöscht") - return jsonify({"success": True, "message": "Drucker erfolgreich gelöscht"}) + app_logger.info(f"✅ Admin API: Drucker {printer_id} abgerufen") + return jsonify({"success": True, "printer": printer_dict}) except Exception as e: - app_logger.error(f"❌ Admin API-Fehler beim Löschen des Druckers {printer_id}: {str(e)}") - return jsonify({"error": "Fehler beim Löschen des Druckers", "details": str(e)}), 500 + app_logger.error(f"❌ Admin API-Fehler beim Abrufen des Druckers {printer_id}: {str(e)}") + 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"]) def api_health_check(): diff --git a/backend/backend/database/myp.db b/backend/backend/database/myp.db index b125759dd..00afb1a42 100644 Binary files a/backend/backend/database/myp.db and b/backend/backend/database/myp.db differ diff --git a/backend/backend/database/myp_backup_20250612_082036.db b/backend/backend/database/myp_backup_20250612_082036.db new file mode 100644 index 000000000..b125759dd Binary files /dev/null and b/backend/backend/database/myp_backup_20250612_082036.db differ diff --git a/backend/blueprints/__pycache__/admin_unified.cpython-313.pyc b/backend/blueprints/__pycache__/admin_unified.cpython-313.pyc index 71bc202c3..8d73425c5 100644 Binary files a/backend/blueprints/__pycache__/admin_unified.cpython-313.pyc and b/backend/blueprints/__pycache__/admin_unified.cpython-313.pyc differ diff --git a/backend/blueprints/admin_unified.py b/backend/blueprints/admin_unified.py index c2c3eacbf..f87e1f2b8 100644 --- a/backend/blueprints/admin_unified.py +++ b/backend/blueprints/admin_unified.py @@ -540,159 +540,16 @@ def delete_user_api(user_id): return jsonify({"error": "Fehler beim Löschen des Benutzers"}), 500 # ===== 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/ - Einzelnen Drucker abrufen +# - POST /api/admin/printers - Neuen Drucker erstellen +# - PUT /api/admin/printers/ - Drucker aktualisieren +# - DELETE /api/admin/printers/ - Drucker löschen -@admin_blueprint.route("/api/printers", methods=["POST"]) -@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/", 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/", 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/", 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 +# Die alten Routen wurden entfernt, um Duplikate zu vermeiden # ===== ERWEITERTE SYSTEM-API (ursprünglich admin_api.py) ===== diff --git a/backend/instance/sessions/0a17d52d4ff50b33926c629e84691cdd_activity.pkl b/backend/instance/sessions/0a17d52d4ff50b33926c629e84691cdd_activity.pkl new file mode 100644 index 000000000..58c0ac0cd Binary files /dev/null and b/backend/instance/sessions/0a17d52d4ff50b33926c629e84691cdd_activity.pkl differ diff --git a/backend/instance/sessions/0ba6772d06a442077e597195e034b3ce_activity.pkl b/backend/instance/sessions/0ba6772d06a442077e597195e034b3ce_activity.pkl new file mode 100644 index 000000000..0624cbd7e Binary files /dev/null and b/backend/instance/sessions/0ba6772d06a442077e597195e034b3ce_activity.pkl differ diff --git a/backend/instance/sessions/0d97f3e71195d96c84f24c9c96a1391d_activity.pkl b/backend/instance/sessions/0d97f3e71195d96c84f24c9c96a1391d_activity.pkl new file mode 100644 index 000000000..c9b976ee4 Binary files /dev/null and b/backend/instance/sessions/0d97f3e71195d96c84f24c9c96a1391d_activity.pkl differ diff --git a/backend/instance/sessions/14aef49ca18e3d331ce219d7b8c6012b_activity.pkl b/backend/instance/sessions/14aef49ca18e3d331ce219d7b8c6012b_activity.pkl new file mode 100644 index 000000000..9d15be42b Binary files /dev/null and b/backend/instance/sessions/14aef49ca18e3d331ce219d7b8c6012b_activity.pkl differ diff --git a/backend/instance/sessions/26a9f101b99be0e0657ec6deaf758565_activity.pkl b/backend/instance/sessions/26a9f101b99be0e0657ec6deaf758565_activity.pkl new file mode 100644 index 000000000..eee76571f Binary files /dev/null and b/backend/instance/sessions/26a9f101b99be0e0657ec6deaf758565_activity.pkl differ diff --git a/backend/instance/sessions/27c2f492eb55af126b24221aa14b47f7_activity.pkl b/backend/instance/sessions/27c2f492eb55af126b24221aa14b47f7_activity.pkl new file mode 100644 index 000000000..e6bb80226 Binary files /dev/null and b/backend/instance/sessions/27c2f492eb55af126b24221aa14b47f7_activity.pkl differ diff --git a/backend/instance/sessions/2bf9099898778a5a4212450b61c48ac1_activity.pkl b/backend/instance/sessions/2bf9099898778a5a4212450b61c48ac1_activity.pkl new file mode 100644 index 000000000..718791be3 Binary files /dev/null and b/backend/instance/sessions/2bf9099898778a5a4212450b61c48ac1_activity.pkl differ diff --git a/backend/instance/sessions/2c11aafacaea26d3cee4cea6d83154ef_activity.pkl b/backend/instance/sessions/2c11aafacaea26d3cee4cea6d83154ef_activity.pkl new file mode 100644 index 000000000..bf87f756e Binary files /dev/null and b/backend/instance/sessions/2c11aafacaea26d3cee4cea6d83154ef_activity.pkl differ diff --git a/backend/instance/sessions/2d9657736e14d091a0231b269adfc14c_activity.pkl b/backend/instance/sessions/2d9657736e14d091a0231b269adfc14c_activity.pkl new file mode 100644 index 000000000..20254c675 Binary files /dev/null and b/backend/instance/sessions/2d9657736e14d091a0231b269adfc14c_activity.pkl differ diff --git a/backend/instance/sessions/2e997c69ced39f05bed8035999776997_activity.pkl b/backend/instance/sessions/2e997c69ced39f05bed8035999776997_activity.pkl new file mode 100644 index 000000000..b309bf1e8 Binary files /dev/null and b/backend/instance/sessions/2e997c69ced39f05bed8035999776997_activity.pkl differ diff --git a/backend/instance/sessions/2fed5be11644058f30f795b01eb8696c_activity.pkl b/backend/instance/sessions/2fed5be11644058f30f795b01eb8696c_activity.pkl new file mode 100644 index 000000000..ca093b25e Binary files /dev/null and b/backend/instance/sessions/2fed5be11644058f30f795b01eb8696c_activity.pkl differ diff --git a/backend/instance/sessions/308d61ea28e9931c2c534a39614d29a0_activity.pkl b/backend/instance/sessions/308d61ea28e9931c2c534a39614d29a0_activity.pkl new file mode 100644 index 000000000..dbf216dc1 Binary files /dev/null and b/backend/instance/sessions/308d61ea28e9931c2c534a39614d29a0_activity.pkl differ diff --git a/backend/instance/sessions/38925b860926d7a43744cc5b03089228_activity.pkl b/backend/instance/sessions/38925b860926d7a43744cc5b03089228_activity.pkl new file mode 100644 index 000000000..b033f804e Binary files /dev/null and b/backend/instance/sessions/38925b860926d7a43744cc5b03089228_activity.pkl differ diff --git a/backend/instance/sessions/3ac20c9d809505ac55f284a07540e405_activity.pkl b/backend/instance/sessions/3ac20c9d809505ac55f284a07540e405_activity.pkl new file mode 100644 index 000000000..fc6d71cea Binary files /dev/null and b/backend/instance/sessions/3ac20c9d809505ac55f284a07540e405_activity.pkl differ diff --git a/backend/instance/sessions/3e23179d58116248761d7447e0bc1910_activity.pkl b/backend/instance/sessions/3e23179d58116248761d7447e0bc1910_activity.pkl new file mode 100644 index 000000000..543fec026 Binary files /dev/null and b/backend/instance/sessions/3e23179d58116248761d7447e0bc1910_activity.pkl differ diff --git a/backend/instance/sessions/41e2ee937a5371a7b85a405868f137ae_activity.pkl b/backend/instance/sessions/41e2ee937a5371a7b85a405868f137ae_activity.pkl new file mode 100644 index 000000000..2cabc6fce Binary files /dev/null and b/backend/instance/sessions/41e2ee937a5371a7b85a405868f137ae_activity.pkl differ diff --git a/backend/instance/sessions/4447f9b7940b2825da947a70a8e5b4af_activity.pkl b/backend/instance/sessions/4447f9b7940b2825da947a70a8e5b4af_activity.pkl new file mode 100644 index 000000000..45b9409a9 Binary files /dev/null and b/backend/instance/sessions/4447f9b7940b2825da947a70a8e5b4af_activity.pkl differ diff --git a/backend/instance/sessions/47927a7c21d64c6164e4d81d60876c22_activity.pkl b/backend/instance/sessions/47927a7c21d64c6164e4d81d60876c22_activity.pkl new file mode 100644 index 000000000..c6c9c4658 Binary files /dev/null and b/backend/instance/sessions/47927a7c21d64c6164e4d81d60876c22_activity.pkl differ diff --git a/backend/instance/sessions/4c06942e7c995443d3fcd266c1579f5d_activity.pkl b/backend/instance/sessions/4c06942e7c995443d3fcd266c1579f5d_activity.pkl new file mode 100644 index 000000000..7343b53f3 Binary files /dev/null and b/backend/instance/sessions/4c06942e7c995443d3fcd266c1579f5d_activity.pkl differ diff --git a/backend/instance/sessions/4d9e8666cc04346bc84e5ee0a2e2f273_activity.pkl b/backend/instance/sessions/4d9e8666cc04346bc84e5ee0a2e2f273_activity.pkl new file mode 100644 index 000000000..81dcedcbf Binary files /dev/null and b/backend/instance/sessions/4d9e8666cc04346bc84e5ee0a2e2f273_activity.pkl differ diff --git a/backend/instance/sessions/4eecb6162ebb50d6ebc1a8fa272219e3_activity.pkl b/backend/instance/sessions/4eecb6162ebb50d6ebc1a8fa272219e3_activity.pkl new file mode 100644 index 000000000..5caa43ab5 Binary files /dev/null and b/backend/instance/sessions/4eecb6162ebb50d6ebc1a8fa272219e3_activity.pkl differ diff --git a/backend/instance/sessions/51a9e0e6371b42f6d201f4f1a71ef17a_activity.pkl b/backend/instance/sessions/51a9e0e6371b42f6d201f4f1a71ef17a_activity.pkl new file mode 100644 index 000000000..090d2856b Binary files /dev/null and b/backend/instance/sessions/51a9e0e6371b42f6d201f4f1a71ef17a_activity.pkl differ diff --git a/backend/instance/sessions/566ed3c164b2feef86f7d72184f7a151_activity.pkl b/backend/instance/sessions/566ed3c164b2feef86f7d72184f7a151_activity.pkl new file mode 100644 index 000000000..61fb70e9f Binary files /dev/null and b/backend/instance/sessions/566ed3c164b2feef86f7d72184f7a151_activity.pkl differ diff --git a/backend/instance/sessions/60aabf800bf4aa0288833d843d4c8930_activity.pkl b/backend/instance/sessions/60aabf800bf4aa0288833d843d4c8930_activity.pkl new file mode 100644 index 000000000..9a5c6ca85 Binary files /dev/null and b/backend/instance/sessions/60aabf800bf4aa0288833d843d4c8930_activity.pkl differ diff --git a/backend/instance/sessions/617b769a670765d199b8759659fb4419_activity.pkl b/backend/instance/sessions/617b769a670765d199b8759659fb4419_activity.pkl new file mode 100644 index 000000000..b093703f6 Binary files /dev/null and b/backend/instance/sessions/617b769a670765d199b8759659fb4419_activity.pkl differ diff --git a/backend/instance/sessions/67db3cdf47cbac4d334fcbbd2bce9b20_activity.pkl b/backend/instance/sessions/67db3cdf47cbac4d334fcbbd2bce9b20_activity.pkl new file mode 100644 index 000000000..4e6b6c4e3 Binary files /dev/null and b/backend/instance/sessions/67db3cdf47cbac4d334fcbbd2bce9b20_activity.pkl differ diff --git a/backend/instance/sessions/69c9ceb173f6c328bdbb42a347912889_activity.pkl b/backend/instance/sessions/69c9ceb173f6c328bdbb42a347912889_activity.pkl new file mode 100644 index 000000000..90ae2d18e Binary files /dev/null and b/backend/instance/sessions/69c9ceb173f6c328bdbb42a347912889_activity.pkl differ diff --git a/backend/instance/sessions/6a8a43e4330992a7717a5582d44fc805_activity.pkl b/backend/instance/sessions/6a8a43e4330992a7717a5582d44fc805_activity.pkl new file mode 100644 index 000000000..53e960430 Binary files /dev/null and b/backend/instance/sessions/6a8a43e4330992a7717a5582d44fc805_activity.pkl differ diff --git a/backend/instance/sessions/6ba2a82b517a1092eba5227053f7a811_activity.pkl b/backend/instance/sessions/6ba2a82b517a1092eba5227053f7a811_activity.pkl new file mode 100644 index 000000000..c1f0b83a1 Binary files /dev/null and b/backend/instance/sessions/6ba2a82b517a1092eba5227053f7a811_activity.pkl differ diff --git a/backend/instance/sessions/6e752ae80d4bbec885192845bcab56ce_activity.pkl b/backend/instance/sessions/6e752ae80d4bbec885192845bcab56ce_activity.pkl new file mode 100644 index 000000000..ba061544c Binary files /dev/null and b/backend/instance/sessions/6e752ae80d4bbec885192845bcab56ce_activity.pkl differ diff --git a/backend/instance/sessions/6f5f3ddc95fa84932f1c08e02b531f4a_activity.pkl b/backend/instance/sessions/6f5f3ddc95fa84932f1c08e02b531f4a_activity.pkl new file mode 100644 index 000000000..6f77b4e60 Binary files /dev/null and b/backend/instance/sessions/6f5f3ddc95fa84932f1c08e02b531f4a_activity.pkl differ diff --git a/backend/instance/sessions/7b49417fa8ccf1898686096a099bfb4e_activity.pkl b/backend/instance/sessions/7b49417fa8ccf1898686096a099bfb4e_activity.pkl new file mode 100644 index 000000000..566bedc96 Binary files /dev/null and b/backend/instance/sessions/7b49417fa8ccf1898686096a099bfb4e_activity.pkl differ diff --git a/backend/instance/sessions/7c1a738a363da0a7c897e806dd3e5bab_activity.pkl b/backend/instance/sessions/7c1a738a363da0a7c897e806dd3e5bab_activity.pkl new file mode 100644 index 000000000..b174ee82e Binary files /dev/null and b/backend/instance/sessions/7c1a738a363da0a7c897e806dd3e5bab_activity.pkl differ diff --git a/backend/instance/sessions/7e508b945fbf6b16dd3d2b69eb26d3b4_activity.pkl b/backend/instance/sessions/7e508b945fbf6b16dd3d2b69eb26d3b4_activity.pkl new file mode 100644 index 000000000..d6245032a Binary files /dev/null and b/backend/instance/sessions/7e508b945fbf6b16dd3d2b69eb26d3b4_activity.pkl differ diff --git a/backend/instance/sessions/8292483482661ea9c5367d097ae96163_activity.pkl b/backend/instance/sessions/8292483482661ea9c5367d097ae96163_activity.pkl new file mode 100644 index 000000000..3c9ef33dc Binary files /dev/null and b/backend/instance/sessions/8292483482661ea9c5367d097ae96163_activity.pkl differ diff --git a/backend/instance/sessions/879ddcd176f94648e52aa4c0eb3d2820_activity.pkl b/backend/instance/sessions/879ddcd176f94648e52aa4c0eb3d2820_activity.pkl new file mode 100644 index 000000000..0bf40a3f6 Binary files /dev/null and b/backend/instance/sessions/879ddcd176f94648e52aa4c0eb3d2820_activity.pkl differ diff --git a/backend/instance/sessions/957e29bf91b2e4a5cd23c59baa38f130_activity.pkl b/backend/instance/sessions/957e29bf91b2e4a5cd23c59baa38f130_activity.pkl new file mode 100644 index 000000000..8220a2d96 Binary files /dev/null and b/backend/instance/sessions/957e29bf91b2e4a5cd23c59baa38f130_activity.pkl differ diff --git a/backend/instance/sessions/95e105829bfbff8ced3408a7f3122e53_activity.pkl b/backend/instance/sessions/95e105829bfbff8ced3408a7f3122e53_activity.pkl new file mode 100644 index 000000000..28d250b83 Binary files /dev/null and b/backend/instance/sessions/95e105829bfbff8ced3408a7f3122e53_activity.pkl differ diff --git a/backend/instance/sessions/98a83c2ecfae6b0481634bcf98cd8d9d_activity.pkl b/backend/instance/sessions/98a83c2ecfae6b0481634bcf98cd8d9d_activity.pkl new file mode 100644 index 000000000..f678f9711 Binary files /dev/null and b/backend/instance/sessions/98a83c2ecfae6b0481634bcf98cd8d9d_activity.pkl differ diff --git a/backend/instance/sessions/9b21f34df0fd7dd2e19ed07dddfa5833_activity.pkl b/backend/instance/sessions/9b21f34df0fd7dd2e19ed07dddfa5833_activity.pkl new file mode 100644 index 000000000..49b705195 Binary files /dev/null and b/backend/instance/sessions/9b21f34df0fd7dd2e19ed07dddfa5833_activity.pkl differ diff --git a/backend/instance/sessions/a001b6883966b2dce6d44bcb0d070e59_activity.pkl b/backend/instance/sessions/a001b6883966b2dce6d44bcb0d070e59_activity.pkl new file mode 100644 index 000000000..a21decf5a Binary files /dev/null and b/backend/instance/sessions/a001b6883966b2dce6d44bcb0d070e59_activity.pkl differ diff --git a/backend/instance/sessions/a5371ed1c91a28bfb2a7a66ddcff7c6a_activity.pkl b/backend/instance/sessions/a5371ed1c91a28bfb2a7a66ddcff7c6a_activity.pkl new file mode 100644 index 000000000..738b55010 Binary files /dev/null and b/backend/instance/sessions/a5371ed1c91a28bfb2a7a66ddcff7c6a_activity.pkl differ diff --git a/backend/instance/sessions/aa8ddd3a9db08b1c0a3b38683599871a_activity.pkl b/backend/instance/sessions/aa8ddd3a9db08b1c0a3b38683599871a_activity.pkl new file mode 100644 index 000000000..ac4ac472f Binary files /dev/null and b/backend/instance/sessions/aa8ddd3a9db08b1c0a3b38683599871a_activity.pkl differ diff --git a/backend/instance/sessions/aaea7cd0392bb02eb5d0ee1810a71152_activity.pkl b/backend/instance/sessions/aaea7cd0392bb02eb5d0ee1810a71152_activity.pkl new file mode 100644 index 000000000..89939110d Binary files /dev/null and b/backend/instance/sessions/aaea7cd0392bb02eb5d0ee1810a71152_activity.pkl differ diff --git a/backend/instance/sessions/ad9da0991af675a8464b8e2dbc3ed97f_activity.pkl b/backend/instance/sessions/ad9da0991af675a8464b8e2dbc3ed97f_activity.pkl new file mode 100644 index 000000000..f0ca0aa67 Binary files /dev/null and b/backend/instance/sessions/ad9da0991af675a8464b8e2dbc3ed97f_activity.pkl differ diff --git a/backend/instance/sessions/adbb83255bf27afe2aee17642a0c25f2_activity.pkl b/backend/instance/sessions/adbb83255bf27afe2aee17642a0c25f2_activity.pkl new file mode 100644 index 000000000..5006e05ec Binary files /dev/null and b/backend/instance/sessions/adbb83255bf27afe2aee17642a0c25f2_activity.pkl differ diff --git a/backend/instance/sessions/afb2606b28b68f5092fbc1da808ac045_activity.pkl b/backend/instance/sessions/afb2606b28b68f5092fbc1da808ac045_activity.pkl new file mode 100644 index 000000000..aebc062ee Binary files /dev/null and b/backend/instance/sessions/afb2606b28b68f5092fbc1da808ac045_activity.pkl differ diff --git a/backend/instance/sessions/b7f9525803a4ce081b1c11029c1ead5c_activity.pkl b/backend/instance/sessions/b7f9525803a4ce081b1c11029c1ead5c_activity.pkl new file mode 100644 index 000000000..dd4a70765 Binary files /dev/null and b/backend/instance/sessions/b7f9525803a4ce081b1c11029c1ead5c_activity.pkl differ diff --git a/backend/instance/sessions/baa79b0692ed06da4bf76f987ae62a68_activity.pkl b/backend/instance/sessions/baa79b0692ed06da4bf76f987ae62a68_activity.pkl new file mode 100644 index 000000000..aae093bb7 Binary files /dev/null and b/backend/instance/sessions/baa79b0692ed06da4bf76f987ae62a68_activity.pkl differ diff --git a/backend/instance/sessions/bba0c7f7ad77401c6a8ac4c7ad985a36_activity.pkl b/backend/instance/sessions/bba0c7f7ad77401c6a8ac4c7ad985a36_activity.pkl new file mode 100644 index 000000000..25db3cff0 Binary files /dev/null and b/backend/instance/sessions/bba0c7f7ad77401c6a8ac4c7ad985a36_activity.pkl differ diff --git a/backend/instance/sessions/bdbe38e73b33b1861c3b83f17d7d2171_activity.pkl b/backend/instance/sessions/bdbe38e73b33b1861c3b83f17d7d2171_activity.pkl new file mode 100644 index 000000000..e76387bd1 Binary files /dev/null and b/backend/instance/sessions/bdbe38e73b33b1861c3b83f17d7d2171_activity.pkl differ diff --git a/backend/instance/sessions/bfe6566b6403a738a07bbd1f1a597bbe_activity.pkl b/backend/instance/sessions/bfe6566b6403a738a07bbd1f1a597bbe_activity.pkl new file mode 100644 index 000000000..64c7c54e5 Binary files /dev/null and b/backend/instance/sessions/bfe6566b6403a738a07bbd1f1a597bbe_activity.pkl differ diff --git a/backend/instance/sessions/c41cab0d63409ed2c93b5f4cf1053b6c_activity.pkl b/backend/instance/sessions/c41cab0d63409ed2c93b5f4cf1053b6c_activity.pkl new file mode 100644 index 000000000..55fc49144 Binary files /dev/null and b/backend/instance/sessions/c41cab0d63409ed2c93b5f4cf1053b6c_activity.pkl differ diff --git a/backend/instance/sessions/c528fb406e973d3852b28f03be599db0_activity.pkl b/backend/instance/sessions/c528fb406e973d3852b28f03be599db0_activity.pkl new file mode 100644 index 000000000..d239cefd1 Binary files /dev/null and b/backend/instance/sessions/c528fb406e973d3852b28f03be599db0_activity.pkl differ diff --git a/backend/instance/sessions/c601f77d2919720e6a1d57bd42b032d7_activity.pkl b/backend/instance/sessions/c601f77d2919720e6a1d57bd42b032d7_activity.pkl new file mode 100644 index 000000000..44b297724 Binary files /dev/null and b/backend/instance/sessions/c601f77d2919720e6a1d57bd42b032d7_activity.pkl differ diff --git a/backend/instance/sessions/c75df00921cfbb9aa5abf4a68ad572e1_activity.pkl b/backend/instance/sessions/c75df00921cfbb9aa5abf4a68ad572e1_activity.pkl new file mode 100644 index 000000000..e1826fcf3 Binary files /dev/null and b/backend/instance/sessions/c75df00921cfbb9aa5abf4a68ad572e1_activity.pkl differ diff --git a/backend/instance/sessions/c9571036101e7de4d2e4812b6f62e26c_activity.pkl b/backend/instance/sessions/c9571036101e7de4d2e4812b6f62e26c_activity.pkl new file mode 100644 index 000000000..153b63b2d Binary files /dev/null and b/backend/instance/sessions/c9571036101e7de4d2e4812b6f62e26c_activity.pkl differ diff --git a/backend/instance/sessions/ca691fb463ecc8a994d0d67e0723a6a7_activity.pkl b/backend/instance/sessions/ca691fb463ecc8a994d0d67e0723a6a7_activity.pkl new file mode 100644 index 000000000..d933ddc0e Binary files /dev/null and b/backend/instance/sessions/ca691fb463ecc8a994d0d67e0723a6a7_activity.pkl differ diff --git a/backend/instance/sessions/ceac826a65a19c6ea5300f6ec0d106e0_activity.pkl b/backend/instance/sessions/ceac826a65a19c6ea5300f6ec0d106e0_activity.pkl new file mode 100644 index 000000000..9eb231fce Binary files /dev/null and b/backend/instance/sessions/ceac826a65a19c6ea5300f6ec0d106e0_activity.pkl differ diff --git a/backend/instance/sessions/d2ddca238fbfb0fc8ac4a7ae741b7958_activity.pkl b/backend/instance/sessions/d2ddca238fbfb0fc8ac4a7ae741b7958_activity.pkl new file mode 100644 index 000000000..dc61fadf1 Binary files /dev/null and b/backend/instance/sessions/d2ddca238fbfb0fc8ac4a7ae741b7958_activity.pkl differ diff --git a/backend/instance/sessions/de33ae957a6f87cdbb2f19fb5f819b40_activity.pkl b/backend/instance/sessions/de33ae957a6f87cdbb2f19fb5f819b40_activity.pkl new file mode 100644 index 000000000..d3a03ca13 Binary files /dev/null and b/backend/instance/sessions/de33ae957a6f87cdbb2f19fb5f819b40_activity.pkl differ diff --git a/backend/instance/sessions/e2ba7f8e40588e3a3edf55399f3cd90e_activity.pkl b/backend/instance/sessions/e2ba7f8e40588e3a3edf55399f3cd90e_activity.pkl new file mode 100644 index 000000000..7a2d0ec4a Binary files /dev/null and b/backend/instance/sessions/e2ba7f8e40588e3a3edf55399f3cd90e_activity.pkl differ diff --git a/backend/instance/sessions/e6260288b7145a2c685051660d52d822_activity.pkl b/backend/instance/sessions/e6260288b7145a2c685051660d52d822_activity.pkl new file mode 100644 index 000000000..ad9e2e564 Binary files /dev/null and b/backend/instance/sessions/e6260288b7145a2c685051660d52d822_activity.pkl differ diff --git a/backend/instance/sessions/e7368c9df150b4bb20f110dc5d5b090f_activity.pkl b/backend/instance/sessions/e7368c9df150b4bb20f110dc5d5b090f_activity.pkl new file mode 100644 index 000000000..c34e278de Binary files /dev/null and b/backend/instance/sessions/e7368c9df150b4bb20f110dc5d5b090f_activity.pkl differ diff --git a/backend/instance/sessions/e8c756c7dbcb0722a09579d99e0b8b94_activity.pkl b/backend/instance/sessions/e8c756c7dbcb0722a09579d99e0b8b94_activity.pkl new file mode 100644 index 000000000..ff791bcbf Binary files /dev/null and b/backend/instance/sessions/e8c756c7dbcb0722a09579d99e0b8b94_activity.pkl differ diff --git a/backend/instance/sessions/eb0d45c3349971f16d13e82df3241be8_activity.pkl b/backend/instance/sessions/eb0d45c3349971f16d13e82df3241be8_activity.pkl new file mode 100644 index 000000000..4a66eaed7 Binary files /dev/null and b/backend/instance/sessions/eb0d45c3349971f16d13e82df3241be8_activity.pkl differ diff --git a/backend/instance/sessions/ed2c71a7e0430ac14896c2a802bca9fc_activity.pkl b/backend/instance/sessions/ed2c71a7e0430ac14896c2a802bca9fc_activity.pkl new file mode 100644 index 000000000..d4908a946 Binary files /dev/null and b/backend/instance/sessions/ed2c71a7e0430ac14896c2a802bca9fc_activity.pkl differ diff --git a/backend/instance/sessions/ef34b65fc96fa9df5c963475ebe37b9f_activity.pkl b/backend/instance/sessions/ef34b65fc96fa9df5c963475ebe37b9f_activity.pkl new file mode 100644 index 000000000..950bd8f6f Binary files /dev/null and b/backend/instance/sessions/ef34b65fc96fa9df5c963475ebe37b9f_activity.pkl differ diff --git a/backend/instance/sessions/f01634096ddbbe6441fd892fd83a864b_activity.pkl b/backend/instance/sessions/f01634096ddbbe6441fd892fd83a864b_activity.pkl new file mode 100644 index 000000000..f7dac76a8 Binary files /dev/null and b/backend/instance/sessions/f01634096ddbbe6441fd892fd83a864b_activity.pkl differ diff --git a/backend/instance/sessions/f532202befe462db048e214fcc0c6780_activity.pkl b/backend/instance/sessions/f532202befe462db048e214fcc0c6780_activity.pkl new file mode 100644 index 000000000..91b4cc1cf Binary files /dev/null and b/backend/instance/sessions/f532202befe462db048e214fcc0c6780_activity.pkl differ diff --git a/backend/instance/sessions/f61f95587ac5a3db770ac8a5f55cfc89_activity.pkl b/backend/instance/sessions/f61f95587ac5a3db770ac8a5f55cfc89_activity.pkl new file mode 100644 index 000000000..743017f5a Binary files /dev/null and b/backend/instance/sessions/f61f95587ac5a3db770ac8a5f55cfc89_activity.pkl differ diff --git a/backend/instance/sessions/fb0b2934c91f2bea57f2b2edf7074724_activity.pkl b/backend/instance/sessions/fb0b2934c91f2bea57f2b2edf7074724_activity.pkl new file mode 100644 index 000000000..c1dcb45f1 Binary files /dev/null and b/backend/instance/sessions/fb0b2934c91f2bea57f2b2edf7074724_activity.pkl differ diff --git a/backend/instance/sessions/fc18b1088f64cce3f544bb5611b6c005_activity.pkl b/backend/instance/sessions/fc18b1088f64cce3f544bb5611b6c005_activity.pkl new file mode 100644 index 000000000..e50947e18 Binary files /dev/null and b/backend/instance/sessions/fc18b1088f64cce3f544bb5611b6c005_activity.pkl differ diff --git a/backend/logs/app/app.log b/backend/logs/app/app.log index 61fc357ad..4f8f86900 100644 --- a/backend/logs/app/app.log +++ b/backend/logs/app/app.log @@ -1415,3 +1415,186 @@ werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'admin. - 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: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 diff --git a/backend/logs/auth/auth.log b/backend/logs/auth/auth.log index afc84d58f..25fb2f45f 100644 --- a/backend/logs/auth/auth.log +++ b/backend/logs/auth/auth.log @@ -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: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:21:14 - [auth] auth - [INFO] INFO - Benutzer admin@mercedes-benz.com hat sich abgemeldet diff --git a/backend/logs/core_system/core_system.log b/backend/logs/core_system/core_system.log index dcb65e82f..c412c041a 100644 --- a/backend/logs/core_system/core_system.log +++ b/backend/logs/core_system/core_system.log @@ -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: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: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) diff --git a/backend/logs/data_management/data_management.log b/backend/logs/data_management/data_management.log index 7fe00c6de..84be95947 100644 --- a/backend/logs/data_management/data_management.log +++ b/backend/logs/data_management/data_management.log @@ -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: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: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) diff --git a/backend/logs/hardware_integration/hardware_integration.log b/backend/logs/hardware_integration/hardware_integration.log index 4e4e35237..942adce35 100644 --- a/backend/logs/hardware_integration/hardware_integration.log +++ b/backend/logs/hardware_integration/hardware_integration.log @@ -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 - ✅ 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: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) diff --git a/backend/logs/job_queue_system/job_queue_system.log b/backend/logs/job_queue_system/job_queue_system.log index df7a3b750..abaffc9bb 100644 --- a/backend/logs/job_queue_system/job_queue_system.log +++ b/backend/logs/job_queue_system/job_queue_system.log @@ -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: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) diff --git a/backend/logs/jobs/jobs.log b/backend/logs/jobs/jobs.log index 99a696a6a..750356c6d 100644 --- a/backend/logs/jobs/jobs.log +++ b/backend/logs/jobs/jobs.log @@ -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: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: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) diff --git a/backend/logs/migration/migration.log b/backend/logs/migration/migration.log new file mode 100644 index 000000000..4f0935f88 --- /dev/null +++ b/backend/logs/migration/migration.log @@ -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 diff --git a/backend/logs/monitoring_analytics/monitoring_analytics.log b/backend/logs/monitoring_analytics/monitoring_analytics.log index d661459a2..47113524b 100644 --- a/backend/logs/monitoring_analytics/monitoring_analytics.log +++ b/backend/logs/monitoring_analytics/monitoring_analytics.log @@ -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: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: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) diff --git a/backend/logs/printers/printers.log b/backend/logs/printers/printers.log index c59989157..d889b5493 100644 --- a/backend/logs/printers/printers.log +++ b/backend/logs/printers/printers.log @@ -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 - [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: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 diff --git a/backend/logs/scheduler/scheduler.log b/backend/logs/scheduler/scheduler.log index 1f2821a5d..e80013002 100644 --- a/backend/logs/scheduler/scheduler.log +++ b/backend/logs/scheduler/scheduler.log @@ -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:57 - [scheduler] scheduler - [INFO] INFO - Scheduler-Thread 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 diff --git a/backend/logs/security_suite/security_suite.log b/backend/logs/security_suite/security_suite.log index afb18a23a..a1fe6e1c8 100644 --- a/backend/logs/security_suite/security_suite.log +++ b/backend/logs/security_suite/security_suite.log @@ -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 - 📊 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: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 diff --git a/backend/logs/sessions/sessions.log b/backend/logs/sessions/sessions.log index 84f71677c..6055a8c1c 100644 --- a/backend/logs/sessions/sessions.log +++ b/backend/logs/sessions/sessions.log @@ -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: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:20:57 - [sessions] sessions - [ERROR] ERROR - Fehler beim Abrufen des Session-Status: 'int' object has no attribute 'total_seconds' diff --git a/backend/logs/startup/startup.log b/backend/logs/startup/startup.log index 3ed4eb970..8ce58e285 100644 --- a/backend/logs/startup/startup.log +++ b/backend/logs/startup/startup.log @@ -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-sichere Log-Rotation: Aktiviert 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 - ================================================== diff --git a/backend/logs/tapo_control/tapo_control.log b/backend/logs/tapo_control/tapo_control.log index 6e0c9a849..7eee259f6 100644 --- a/backend/logs/tapo_control/tapo_control.log +++ b/backend/logs/tapo_control/tapo_control.log @@ -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: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: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 diff --git a/backend/logs/tapo_controller/tapo_controller.log b/backend/logs/tapo_controller/tapo_controller.log index a0a4ec076..adff47645 100644 --- a/backend/logs/tapo_controller/tapo_controller.log +++ b/backend/logs/tapo_controller/tapo_controller.log @@ -12,3 +12,5 @@ 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: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 diff --git a/backend/logs/user/user.log b/backend/logs/user/user.log index afa697b6d..43cadebc6 100644 --- a/backend/logs/user/user.log +++ b/backend/logs/user/user.log @@ -3,3 +3,6 @@ 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: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 diff --git a/backend/logs/utilities_collection/utilities_collection.log b/backend/logs/utilities_collection/utilities_collection.log index 293f2ab9e..4b6b08c2d 100644 --- a/backend/logs/utilities_collection/utilities_collection.log +++ b/backend/logs/utilities_collection/utilities_collection.log @@ -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: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: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) diff --git a/backend/logs/windows_fixes/windows_fixes.log b/backend/logs/windows_fixes/windows_fixes.log index 90e3dfe9c..25964efc1 100644 --- a/backend/logs/windows_fixes/windows_fixes.log +++ b/backend/logs/windows_fixes/windows_fixes.log @@ -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: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: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 diff --git a/backend/models.py b/backend/models.py index bea5d5f1f..ea4b1a943 100644 --- a/backend/models.py +++ b/backend/models.py @@ -529,14 +529,15 @@ class Printer(Base): model = Column(String(100)) # Drucker-Modell location = Column(String(100)) ip_address = Column(String(50)) # IP-Adresse des Druckers - mac_address = Column(String(50), nullable=False, unique=True) - plug_ip = Column(String(50), nullable=False) - plug_username = Column(String(100), nullable=False) - plug_password = Column(String(100), nullable=False) + mac_address = Column(String(50), nullable=True, unique=True) # Jetzt nullable + plug_ip = Column(String(50), nullable=True) # Jetzt nullable + plug_username = Column(String(100), nullable=True) # Jetzt nullable + plug_password = Column(String(100), nullable=True) # Jetzt nullable status = Column(String(20), default="offline") # online, offline, busy, idle active = Column(Boolean, default=True) created_at = Column(DateTime, default=datetime.now) 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") diff --git a/backend/scripts/migrate_database.py b/backend/scripts/migrate_database.py new file mode 100644 index 000000000..444a5659f --- /dev/null +++ b/backend/scripts/migrate_database.py @@ -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() \ No newline at end of file diff --git a/backend/templates/admin_add_printer.html b/backend/templates/admin_add_printer.html index 16019047e..ad41d6143 100644 --- a/backend/templates/admin_add_printer.html +++ b/backend/templates/admin_add_printer.html @@ -38,7 +38,7 @@
-
+ @@ -52,34 +52,20 @@ name="name" required class="w-full px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-slate-800 text-slate-900 dark:text-white" - placeholder="3D-Drucker Raum A001"> -
- - -
- - -

IP-Adresse der Tapo-Steckdose

+ placeholder="z.B. Prusa MK3S+ Raum 101">
+ placeholder="z.B. Prusa i3 MK3S+">
@@ -91,33 +77,77 @@ id="location" name="location" class="w-full px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white dark:bg-slate-800 text-slate-900 dark:text-white" - placeholder="Raum A001, Erdgeschoss"> + placeholder="z.B. Werkstatt Erdgeschoss"> - + +
+

+ Tapo Smart-Plug Konfiguration (optional) +

+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ +
-
-
@@ -128,9 +158,9 @@

Hinweise:

  • Felder mit * sind Pflichtfelder
  • -
  • Die IP-Adresse sollte die Adresse der Tapo-Steckdose sein
  • -
  • Der Drucker wird automatisch mit Standard-Tapo-Einstellungen konfiguriert
  • -
  • Status "Verfügbar" bedeutet bereit für Druckaufträge
  • +
  • Die Tapo-Konfiguration ist optional, ermöglicht aber die Stromsteuerung
  • +
  • Bei fehlenden Tapo-Zugangsdaten werden die globalen Einstellungen verwendet
  • +
  • Eine MAC-Adresse wird automatisch generiert wenn nicht vorhanden
@@ -139,6 +169,7 @@
@@ -154,55 +185,96 @@ {% endblock %} {% block extra_js %} - + {% endblock %} \ No newline at end of file diff --git a/backend/templates/admin_edit_printer.html b/backend/templates/admin_edit_printer.html index 20329d0cb..7d3f789ad 100644 --- a/backend/templates/admin_edit_printer.html +++ b/backend/templates/admin_edit_printer.html @@ -16,6 +16,10 @@ background: rgba(30, 41, 59, 0.95); border: 1px solid rgba(255, 255, 255, 0.1); } + + .test-result { + transition: all 0.3s ease; + } {% endblock %} @@ -34,20 +38,20 @@ Zurück
-
-

- - Drucker-ID: {{ printer.id }} | - Erstellt am: {{ printer.created_at[:10] if printer.created_at else 'Unbekannt' }} -

-
- -
- + +
+ +

Drucker-Daten werden geladen...

+
+ + + - -
- - -
- - -
- - -
- - -
- -

Inaktive Drucker werden nicht für neue Aufträge verwendet

-
- - -
-

- Drucker-Informationen -

-
-
- MAC-Adresse: - {{ printer.mac_address or 'Nicht verfügbar' }} -
-
- Letzter Check: - {{ printer.last_checked or 'Nie' }} -
+ +
+
+

+ Tapo Smart-Plug Konfiguration +

+ +
+ + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +

+ Lassen Sie dieses Feld leer, wenn Sie es nicht ändern möchten +

- -
+ +
+ + +

IP-Adresse des Druckers selbst (falls verfügbar)

+
+ + +
+ + +
+ + +
+ + + +
+ Aktueller Status: + +
+
+ + +
- -
-

Wichtige Hinweise:

+ +
+

Hinweise:

    -
  • Änderungen an der IP-Adresse können die Verbindung unterbrechen
  • -
  • Stellen Sie sicher, dass die Tapo-Steckdose unter der neuen IP erreichbar ist
  • -
  • Bei Status-Änderungen werden laufende Jobs möglicherweise beeinflusst
  • +
  • Felder mit * sind Pflichtfelder
  • +
  • Die MAC-Adresse kann nicht geändert werden
  • +
  • Lassen Sie das Passwort-Feld leer, wenn Sie es nicht ändern möchten
  • +
  • Testen Sie die Verbindung nach Änderungen an der Tapo-Konfiguration
@@ -182,9 +211,15 @@
+ Abbrechen @@ -192,191 +227,259 @@
- - -
-

- Drucker-Aktionen -

-
- - -
-
{% endblock %} {% block extra_js %} - + {% endblock %} \ No newline at end of file diff --git a/backend/utils/api_utils.py b/backend/utils/api_utils.py new file mode 100644 index 000000000..9b14af3cb --- /dev/null +++ b/backend/utils/api_utils.py @@ -0,0 +1,200 @@ +""" +API-Utilities für konsistente Response-Strukturen +=============================================== + +Dieses Modul enthält Hilfsfunktionen zur Standardisierung von API-Responses +und zur Behandlung verschiedener Response-Formate im MYP-System. +""" + +from datetime import datetime +from flask import jsonify +from typing import Dict, List, Any, Optional, Union + + +def create_success_response(data: Any = None, message: str = None, **kwargs) -> Dict[str, Any]: + """ + Erstellt eine standardisierte Erfolgs-Response. + + Args: + data: Die zurückzugebenden Daten + message: Optionale Erfolgs-Nachricht + **kwargs: Zusätzliche Felder für die Response + + Returns: + dict: Standardisierte Erfolgs-Response + """ + response = { + "success": True, + "timestamp": datetime.now().isoformat() + } + + if data is not None: + response["data"] = data + + if message: + response["message"] = message + + # Zusätzliche Felder hinzufügen + response.update(kwargs) + + return response + + +def create_error_response(error: str, details: str = None, **kwargs) -> Dict[str, Any]: + """ + Erstellt eine standardisierte Fehler-Response. + + Args: + error: Haupt-Fehlermeldung + details: Detaillierte Fehlerinformationen + **kwargs: Zusätzliche Felder für die Response + + Returns: + dict: Standardisierte Fehler-Response + """ + response = { + "success": False, + "error": error, + "timestamp": datetime.now().isoformat() + } + + if details: + response["details"] = details + + # Zusätzliche Felder hinzufügen + response.update(kwargs) + + return response + + +def create_printers_response(printers: List[Dict], message: str = None) -> Dict[str, Any]: + """ + Erstellt eine standardisierte Response für Drucker-Listen. + + Args: + printers: Liste der Drucker-Daten + message: Optionale Nachricht + + Returns: + dict: Standardisierte Drucker-Response + """ + return create_success_response( + printers=printers, + count=len(printers), + message=message or "Drucker erfolgreich geladen" + ) + + +def validate_printer_data(printer_dict: Dict[str, Any]) -> Dict[str, Any]: + """ + Validiert und standardisiert Drucker-Daten. + + Args: + printer_dict: Rohe Drucker-Daten + + Returns: + dict: Validierte und standardisierte Drucker-Daten + """ + return { + "id": printer_dict.get("id"), + "name": printer_dict.get("name", "Unbekannter Drucker"), + "model": printer_dict.get("model") or "Unbekanntes Modell", + "location": printer_dict.get("location") or "Unbekannter Standort", + "status": printer_dict.get("status") or "offline", + "ip_address": printer_dict.get("ip_address"), + "plug_ip": printer_dict.get("plug_ip"), + "active": printer_dict.get("active", True), + "created_at": printer_dict.get("created_at"), + "last_checked": printer_dict.get("last_checked") + } + + +def handle_api_exception(error: Exception, context: str = "API-Operation") -> tuple: + """ + Behandelt API-Exceptions und erstellt konsistente Fehler-Responses. + + Args: + error: Die aufgetretene Exception + context: Kontext der Operation für bessere Fehlermeldungen + + Returns: + tuple: (response_dict, status_code) + """ + error_message = f"Fehler bei {context}" + + response = create_error_response( + error=error_message, + details=str(error) + ) + + # Standard HTTP-Status für verschiedene Exception-Typen + status_code = 500 + + if "not found" in str(error).lower(): + status_code = 404 + elif "permission" in str(error).lower() or "unauthorized" in str(error).lower(): + status_code = 403 + elif "validation" in str(error).lower() or "invalid" in str(error).lower(): + status_code = 400 + + return response, status_code + + +class ResponseValidator: + """ + Klasse zur Validierung und Standardisierung von API-Responses. + """ + + @staticmethod + def is_valid_response(response_data: Dict[str, Any]) -> bool: + """ + Prüft, ob eine Response-Struktur gültig ist. + + Args: + response_data: Zu prüfende Response-Daten + + Returns: + bool: True wenn gültig + """ + if not isinstance(response_data, dict): + return False + + # Minimal erforderliche Felder + has_success = "success" in response_data + has_data_or_error = any(key in response_data for key in ["data", "error", "printers", "message"]) + + return has_success and has_data_or_error + + @staticmethod + def normalize_response(response_data: Dict[str, Any]) -> Dict[str, Any]: + """ + Normalisiert eine Response auf das Standard-Format. + + Args: + response_data: Zu normalisierende Response-Daten + + Returns: + dict: Normalisierte Response + """ + if ResponseValidator.is_valid_response(response_data): + return response_data + + # Legacy-Format konvertieren + if "printers" in response_data and "success" not in response_data: + return create_printers_response( + printers=response_data["printers"], + message=response_data.get("message") + ) + + # Error-only Format konvertieren + if "error" in response_data and "success" not in response_data: + return create_error_response( + error=response_data["error"], + details=response_data.get("details") + ) + + # Fallback für unbekannte Formate + return create_error_response( + error="Unbekannte Response-Struktur", + details="Die Response konnte nicht verarbeitet werden" + ) \ No newline at end of file