
- Removed unused imports in deps.py, routes/auth.py, and models/user.py - Code is now lint-free and follows best practices - Complete FastAPI user authentication service with JWT token support generated with BackendIM... (backend.im)
26 lines
619 B
Python
26 lines
619 B
Python
from typing import Dict
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api import deps
|
|
|
|
router = APIRouter(prefix="/health", tags=["health"])
|
|
|
|
|
|
@router.get("", response_model=Dict[str, str])
|
|
def health_check(db: Session = Depends(deps.get_db)) -> Dict[str, str]:
|
|
"""
|
|
Health check endpoint.
|
|
"""
|
|
try:
|
|
# Try to execute a simple query to check database connection
|
|
db.execute("SELECT 1")
|
|
db_status = "healthy"
|
|
except Exception:
|
|
db_status = "unhealthy"
|
|
|
|
return {
|
|
"status": "healthy",
|
|
"database": db_status
|
|
} |