import logging from fastapi import APIRouter from sqlmodel import select from app.api.dependencies import SessionDep from app.core.config import settings logger = logging.getLogger(__name__) router = APIRouter(prefix="/utils", tags=["Utils"]) @router.get("/health-check/") async def health_check() -> bool: """ Ping the API whether it's alive or not """ return True @router.get("/test-db/", include_in_schema=settings.is_local_environment) async def test_db(session: SessionDep) -> bool: """ Ping database using select 1 to see if connection works """ try: session.exec(select(1)) return True except Exception as e: logger.error(e) return False