first commit

This commit is contained in:
Mplan committed 2026-07-18 20:32:51 +08:00
commit 77bf076ad0
34 files changed
+4068

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
from fastapi import APIRouter, HTTPException, status
from sqlalchemy import text
from app.deps import DbSession
router = APIRouter(tags=["系统"])
@router.get("/health")
async def health(db: DbSession) -> dict[str, str]:
try:
await db.execute(text("select 1"))
except Exception as exc:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail="数据库不可用",
) from exc
return {"status": "ok", "database": "ok"}