This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Any
|
||||
|
||||
from graphql.error import GraphQLError
|
||||
|
||||
from auth.orm import Author
|
||||
# Импорт Author отложен для избежания циклических импортов
|
||||
from orm.community import Community
|
||||
from orm.draft import Draft
|
||||
from orm.reaction import Reaction
|
||||
@@ -11,6 +11,12 @@ from orm.shout import Shout
|
||||
from orm.topic import Topic
|
||||
from utils.logger import root_logger as logger
|
||||
|
||||
# Отложенный импорт Author для избежания циклических импортов
|
||||
def get_author_model():
|
||||
"""Возвращает модель Author для использования в common_result"""
|
||||
from auth.orm import Author
|
||||
return Author
|
||||
|
||||
|
||||
def handle_error(operation: str, error: Exception) -> GraphQLError:
|
||||
"""Обрабатывает ошибки в резолверах"""
|
||||
@@ -28,8 +34,8 @@ class CommonResult:
|
||||
slugs: list[str] | None = None
|
||||
shout: Shout | None = None
|
||||
shouts: list[Shout] | None = None
|
||||
author: Author | None = None
|
||||
authors: list[Author] | None = None
|
||||
author: Any | None = None # Author type resolved at runtime
|
||||
authors: list[Any] | None = None # Author type resolved at runtime
|
||||
reaction: Reaction | None = None
|
||||
reactions: list[Reaction] | None = None
|
||||
topic: Topic | None = None
|
||||
|
||||
Reference in New Issue
Block a user