refactor: 重构后端结构并迁移前端到 Vue3

This commit is contained in:
2026-05-15 11:46:21 +08:00
parent 9107378fcc
commit 9c5a5a54c6
165 changed files with 5057 additions and 62710 deletions
+42
View File
@@ -0,0 +1,42 @@
import os
from datetime import datetime
from fastapi import APIRouter
from app import state
from app.database import DatabaseManager
router = APIRouter(tags=["health"])
@router.get("/health")
async def health_check():
checks = {
"app": {"status": "ok"},
"database": {"status": "unknown"},
}
try:
db_manager = DatabaseManager(state.config)
try:
server_info = db_manager.get_server_info()
checks["database"] = {
"status": "ok",
"version": server_info.get("version", "unknown"),
"load_data_infile": server_info.get("load_data_infile", False),
}
finally:
db_manager.dispose()
except Exception as exc:
checks["database"] = {"status": "error", "message": str(exc)}
is_healthy = all(check.get("status") == "ok" for check in checks.values())
return {
"status": "healthy" if is_healthy else "unhealthy",
"timestamp": datetime.now().isoformat(),
"version": "2.0.2",
"uptime_pid": os.getpid(),
"checks": checks,
}