Реализовать observability для лабораторной 6
This commit is contained in:
@@ -16,6 +16,21 @@ router = APIRouter(tags=['attachments'])
|
||||
'/api/v1/chats/{chat_id}/attachments',
|
||||
status_code=202,
|
||||
response_model=AttachmentOut,
|
||||
summary='Принять PNG/JPEG на асинхронную обработку',
|
||||
openapi_extra={
|
||||
'requestBody': {
|
||||
'required': True,
|
||||
'description': 'Сырые байты изображения, не multipart/form-data.',
|
||||
'content': {
|
||||
'image/png': {
|
||||
'schema': {'type': 'string', 'format': 'binary'},
|
||||
},
|
||||
'image/jpeg': {
|
||||
'schema': {'type': 'string', 'format': 'binary'},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
async def upload(
|
||||
chat_id: UUID,
|
||||
|
||||
@@ -3,13 +3,14 @@ from __future__ import annotations
|
||||
import base64
|
||||
from binascii import Error as Base64Error
|
||||
|
||||
from fastapi import APIRouter, Depends, Header, HTTPException, status
|
||||
from fastapi import APIRouter, Depends, HTTPException, Security, status
|
||||
|
||||
from ...auth.tokens import create_token
|
||||
from ...db.redis import RedisSessionStore
|
||||
from ...domain.models import User
|
||||
from ...services.users import UserService
|
||||
from ..deps import bearer_token, current_user, session_store, user_service
|
||||
from ..security import basic_auth
|
||||
from ..schemas import SessionOut, UserOut
|
||||
from ..timefmt import to_rfc3339
|
||||
|
||||
@@ -44,7 +45,7 @@ def _parse_basic(authorization: str | None) -> tuple[str, str]:
|
||||
|
||||
@router.post('', status_code=status.HTTP_201_CREATED, response_model=SessionOut)
|
||||
async def create_session(
|
||||
authorization: str | None = Header(None),
|
||||
authorization: str | None = Security(basic_auth),
|
||||
users: UserService = Depends(user_service),
|
||||
sessions: RedisSessionStore = Depends(session_store),
|
||||
) -> SessionOut:
|
||||
|
||||
Reference in New Issue
Block a user