19 lines
444 B
Python
19 lines
444 B
Python
|
|
from fastapi import APIRouter, Depends
|
||
|
|
from sqlalchemy import text
|
||
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||
|
|
|
||
|
|
from app.database import get_db
|
||
|
|
|
||
|
|
router = APIRouter(tags=["health"])
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/health")
|
||
|
|
async def health() -> dict:
|
||
|
|
return {"status": "ok"}
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/health/db")
|
||
|
|
async def health_db(db: AsyncSession = Depends(get_db)) -> dict:
|
||
|
|
await db.execute(text("SELECT 1"))
|
||
|
|
return {"status": "ok", "database": "ok"}
|