from fastapi import APIRouter, Depends, HTTPException from sqlalchemy import text from sqlalchemy.ext.asyncio import AsyncSession from ..db import get_session from ..schemas import HealthResponse router = APIRouter() @router.get("/health", response_model=HealthResponse) async def health() -> HealthResponse: return HealthResponse() @router.get("/ready", response_model=HealthResponse) async def ready(session: AsyncSession = Depends(get_session)) -> HealthResponse: try: await session.execute(text("SELECT 1")) except Exception as exc: raise HTTPException(status_code=503, detail="database not reachable") from exc return HealthResponse()