From b4eff32427a7549371a47beefda83ee51d6ba1dd Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 14 Nov 2024 13:33:09 +0300 Subject: [PATCH] authorized-context-debug --- resolvers/reader.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resolvers/reader.py b/resolvers/reader.py index 164d911f..ae35a007 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -58,6 +58,9 @@ def has_field(info, fieldname: str) -> bool: def query_with_stat(info): """ + :param info: Информация о контексте GraphQL - для получения id авторизованного пользователя + :return: Запрос с подзапросами статистики. + Добавляет подзапрос статистики """ q = ( @@ -164,12 +167,14 @@ def query_with_stat(info): .subquery() ) + logger.debug(info) + logger.debug(info.context) + logger.debug(info.context.get("author")) author_dict = info.context.get("author") if info.context else None author_id = author_dict.get("id") if author_dict else None - logger.info(f"Current author_id: {author_id}") if author_id: - logger.info(f"Building user reaction query for author {author_id}") + logger.info(f"detected author_id: {author_id}") user_reaction_subquery = ( select( Reaction.shout.label("shout_id"),