20 lines
460 B
Python
20 lines
460 B
Python
from datetime import datetime, timezone
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy import text
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api.deps import get_db
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/health")
|
|
def health(db: Session = Depends(get_db)):
|
|
status = "ok"
|
|
try:
|
|
db.execute(text("SELECT 1"))
|
|
except Exception:
|
|
status = "error"
|
|
return {"status": status, "timestamp": datetime.now(timezone.utc).isoformat()}
|