feat: функционал первой лабы перенос

This commit is contained in:
Enterxx2
2026-10-11 13:24:29 +03:00
parent 65003b6119
commit a6c74c9bb0
90 changed files with 2746 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
from fastapi import APIRouter, Request, status
from domain import HealthSchema
from domain.errors import UnavailableError
health_router = APIRouter(prefix="/health", tags=["Health"])
@health_router.get(
"/live",
status_code=status.HTTP_200_OK,
response_model=HealthSchema,
)
async def liveness() -> HealthSchema:
"""Процесс жив и обрабатывает хттп"""
return HealthSchema()
@health_router.get(
"/ready",
status_code=status.HTTP_200_OK,
response_model=HealthSchema,
)
async def readiness(request: Request) -> HealthSchema:
"""Хранилище создано и приложение не завершается"""
if not getattr(request.app.state, "is_ready", False):
raise UnavailableError()
return HealthSchema()