init commit: create skeleton from lab1

This commit is contained in:
2026-10-16 22:39:23 +03:00
parent 65003b6119
commit aecd8d2957
70 changed files with 3205 additions and 8 deletions
+21
View File
@@ -0,0 +1,21 @@
from fastapi import APIRouter, Request
from app.core.database import check_database
from app.errors.exceptions import unavailable
from app.schemas.base import Health
router = APIRouter(prefix="/health", tags=["health"])
@router.get("/live")
async def liveness() -> Health:
# Только «процесс жив»: БД намеренно не трогаем.
return Health(status="ok")
@router.get("/ready")
def readiness(request: Request) -> Health:
# Готовность = приложение может обслужить синхронный путь, а он требует БД.
if not check_database(request.app.state.engine):
raise unavailable()
return Health(status="ok")