feat: ЛР2 - PostgreSQL, Redis сессии и keyset-пагинация

This commit is contained in:
Ильяс
2026-10-23 12:45:58 +03:00
parent 5893d051c1
commit 9ddb2244bc
25 changed files with 1332 additions and 423 deletions
+15
View File
@@ -29,6 +29,21 @@ class RequestIdAndLoggingMiddleware(BaseHTTPMiddleware):
request.state.request_id = request_id
start_time = time.monotonic()
if request.method in ("POST", "PUT", "PATCH") and request.url.path != "/api/v1/auth/sessions":
ct = request.headers.get("content-type")
if ct:
ct_clean = ct.split(";")[0].strip().lower()
if ct_clean != "application/json":
from fastapi import status
from app.errors import make_error_response
from app.schemas import ErrorCode
return make_error_response(
status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
ErrorCode.UNSUPPORTED_MEDIA_TYPE,
f"Неподдерживаемый тип содержимого '{ct}'. Ожидается application/json",
request_id,
)
try:
response = await call_next(request)
except Exception: