[rewrite] Minor fixes to models, session generator and example .env

This commit is contained in:
Thastertyn committed 2025-03-10 22:02:30 +01:00
1 parent 71e916586e
commit 272e765ca8
4 files changed
+16 -10

No files matched your search

+9 -4
View File
@@ -1,8 +1,12 @@
import logging
from sqlmodel import select
from fastapi import APIRouter
from app.api.dependencies import SessionDep
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/utils", tags=["utils"])
@@ -10,11 +14,12 @@ router = APIRouter(prefix="/utils", tags=["utils"])
async def health_check() -> bool:
return True
@router.get("/test-db/")
async def test_db(session: SessionDep) -> bool:
try:
with session:
session.exec(select(1))
return True
except Exception:
session.exec(select(1))
return True
except Exception as e:
logger.error(e)
return False