bmc_hub/patch_bottombar_router.py

65 lines
1.9 KiB
Python
Raw Normal View History

with open("app/modules/bottom_bar/backend/router.py", "r") as f:
content = f.read()
# Replace the whole endpoint
import re
new_content = """from fastapi import APIRouter
from app.core.config import settings
router = APIRouter()
@router.get("/state")
async def get_bottom_bar_state():
# MVP Mock Data for the updated Bottom Bar & Chef-overblik
return {
"enabled": True,
"sections": {
"mail": {
"unread": 5,
"customer_reply_needed": 2
},
"cases": {
"open": 12,
"list": [{"id": 100, "title": "Blandet sag A"}, {"id": 105, "title": "Sag B"}]
},
"urgent": {
"count": 1,
"list": [{"id": 999, "title": "Server nede hos Kunde A"}]
},
"timer": {
"active_count": 1,
"list": [{"desc": "Fejlfinding WiFi", "elapsed": 1200}]
},
"kuma": {
"down": 3,
"list": ["Switch-Odense", "Printer-Aarhus", "FW-Kbh"]
},
"eset": {
"incidents": 0,
"list": []
},
"messages": {
"count": 2,
"list": [{"from": "Chef", "text": "Husk at ringe til Jensen"}, {"from": "System", "text": "Ny opgave tildelt."}]
},
"tasks": {
"count": 4,
"list": [
{"title": "Opsætning af ny PC", "deadline": "I dag 14:00"},
{"title": "Gennemgå ESET log", "deadline": "I dag 16:00"}
]
},
"boss": {
"stats": {
"unassigned": 3,
"active_employees": 4
}
}
}
}
"""
with open("app/modules/bottom_bar/backend/router.py", "w") as f:
f.write(new_content)