26 lines
581 B
Python
26 lines
581 B
Python
from typing import Dict
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api.deps import get_db
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/", response_model=Dict[str, str])
|
|
def health_check(db: Session = Depends(get_db)) -> Dict[str, str]:
|
|
"""
|
|
Check service health.
|
|
"""
|
|
# Try to execute a simple query to verify database connection
|
|
try:
|
|
db.execute("SELECT 1")
|
|
db_status = "healthy"
|
|
except Exception:
|
|
db_status = "unhealthy"
|
|
|
|
return {
|
|
"status": "healthy",
|
|
"database": db_status
|
|
}
|