From a7fc2487e9aed0b8b05cbd057a92201e8a088882 Mon Sep 17 00:00:00 2001 From: Arxip222 Date: Tue, 23 Dec 2025 12:25:46 +0300 Subject: [PATCH] micro fix dishka --- backend/requirements.txt | 2 +- backend/src/presentation/api/v1/collections.py | 13 ++++++------- backend/src/presentation/main.py | 2 ++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/requirements.txt b/backend/requirements.txt index 69742a0..05f1776 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -9,7 +9,7 @@ python-multipart==0.0.6 httpx==0.25.2 PyMuPDF==1.23.8 Pillow==10.2.0 -dishka==0.7.0 +dishka==1.7.2 numpy==1.26.4 sentence-transformers==2.7.0 qdrant-client==1.9.0 diff --git a/backend/src/presentation/api/v1/collections.py b/backend/src/presentation/api/v1/collections.py index 5d8e3c8..0b0431e 100644 --- a/backend/src/presentation/api/v1/collections.py +++ b/backend/src/presentation/api/v1/collections.py @@ -17,7 +17,6 @@ from src.presentation.schemas.collection_schemas import ( ) from src.application.use_cases.collection_use_cases import CollectionUseCases from src.domain.entities.user import User -from src.presentation.middleware.auth_middleware import get_current_user router = APIRouter(prefix="/collections", tags=["collections"]) @@ -25,7 +24,7 @@ router = APIRouter(prefix="/collections", tags=["collections"]) @router.post("", response_model=CollectionResponse, status_code=status.HTTP_201_CREATED) async def create_collection( collection_data: CollectionCreate, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Создать коллекцию""" @@ -52,7 +51,7 @@ async def get_collection( async def update_collection( collection_id: UUID, collection_data: CollectionUpdate, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Обновить коллекцию""" @@ -69,7 +68,7 @@ async def update_collection( @router.delete("/{collection_id}", status_code=status.HTTP_204_NO_CONTENT) async def delete_collection( collection_id: UUID, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Удалить коллекцию""" @@ -81,7 +80,7 @@ async def delete_collection( async def list_collections( skip: int = 0, limit: int = 100, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Получить список коллекций, доступных пользователю""" @@ -97,7 +96,7 @@ async def list_collections( async def grant_access( collection_id: UUID, access_data: CollectionAccessGrant, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Предоставить доступ пользователю к коллекции""" @@ -113,7 +112,7 @@ async def grant_access( async def revoke_access( collection_id: UUID, user_id: UUID, - current_user: User = FromDishka(), + current_user: FromDishka[User] = FromDishka(), use_cases: FromDishka[CollectionUseCases] = FromDishka() ): """Отозвать доступ пользователя к коллекции""" diff --git a/backend/src/presentation/main.py b/backend/src/presentation/main.py index 05122c5..359fe35 100644 --- a/backend/src/presentation/main.py +++ b/backend/src/presentation/main.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import sys import os