diff --git a/src/ugc/containers.py b/src/ugc/containers.py index a203fa1..e9719f5 100644 --- a/src/ugc/containers.py +++ b/src/ugc/containers.py @@ -3,7 +3,7 @@ import orjson from dependency_injector import containers, providers -from ugc.domain import bookmarks, processors, progress +from ugc.domain import bookmarks, processors, progress, reviews from ugc.domain.bookmarks.models import FilmBookmark from ugc.domain.progress.models import UserFilmProgress from ugc.helpers import sentinel @@ -159,6 +159,15 @@ class Container(containers.DeclarativeContainer): message_callback=bookmark_processor, ) + # Domain -> Reviews + + review_repository = providers.Singleton(reviews.ReviewRepository) + + review_service = providers.Factory( + reviews.ReviewService, + review_repository=review_repository, + ) + def override_providers(container: Container) -> Container: """Перезаписывание провайдеров с помощью стабов.""" diff --git a/src/ugc/domain/reviews/__init__.py b/src/ugc/domain/reviews/__init__.py new file mode 100644 index 0000000..c0a0004 --- /dev/null +++ b/src/ugc/domain/reviews/__init__.py @@ -0,0 +1,7 @@ +from .repositories import ReviewRepository +from .services import ReviewService + +__all__ = [ + "ReviewRepository", + "ReviewService", +] diff --git a/src/ugc/domain/reviews/repositories.py b/src/ugc/domain/reviews/repositories.py new file mode 100644 index 0000000..1ff9992 --- /dev/null +++ b/src/ugc/domain/reviews/repositories.py @@ -0,0 +1,5 @@ +class ReviewRepository: + """Репозиторий для работы с данными рецензий.""" + + async def create(self): + """Создание рецензии.""" diff --git a/src/ugc/domain/reviews/services.py b/src/ugc/domain/reviews/services.py new file mode 100644 index 0000000..21d0528 --- /dev/null +++ b/src/ugc/domain/reviews/services.py @@ -0,0 +1,13 @@ +from .repositories import ReviewRepository + + +class ReviewService: + """Сервис для работы с рецензиями.""" + + def __init__(self, review_repository: ReviewRepository) -> None: + assert isinstance(review_repository, ReviewRepository) + self._repository = review_repository + + async def create_review(self): + """Создание новой рецензии на фильм.""" + await self._repository.create()