Files
mtusi2026lab4-safronov/src/api/routers/health.py
T
ricoromaandClaude Opus 5.5 5d5d8f9d2a chore: carry lab 3 over
- carry the lab 3 solution over from mtusi2026lab3-safronov
  (solution/bvt2301-safronov, ce89eba): src, migrations, student-tests,
  bench, openspec, .claude, infra/haproxy and infra/valkey, own scripts,
  Dockerfile, compose, pyproject and uv lock
- merge Makefile, .gitignore and .dockerignore (the lab 3 versions only
  add lines to the skeleton, which is the same in lab 4) and
  .env.example (lab 4 skeleton names listed in the header)
- rename the compose project to mtusi-lab4 and the image to :lab4 so
  the stand does not reuse the lab 3 containers and volumes
- update AGENTS.md for lab 4: current lab, origin commit, contract and
  test files of the new skeleton

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:32:33 +03:00

26 lines
877 B
Python

from fastapi import APIRouter, Depends
from src.api.dependencies import require_database
from src.api.schemas import Error, Health
from src.utils.constants import HEALTH_LIVE_PATH, HEALTH_READY_PATH
# вне версии API и без идентификации; из итоговой записи о запросе исключены
router = APIRouter(tags=["health"])
@router.get(HEALTH_LIVE_PATH, response_model=Health)
async def liveness() -> Health:
"""Процесс жив и обслуживает HTTP."""
return Health(status="ok")
@router.get(
HEALTH_READY_PATH,
response_model=Health,
responses={503: {"model": Error}},
dependencies=[Depends(require_database)],
)
async def readiness() -> Health:
"""Postgres отвечает — можно обслуживать запросы; иначе 503."""
return Health(status="ok")