authorized-context-debug
All checks were successful
Deploy on push / deploy (push) Successful in 6s

This commit is contained in:
Untone 2024-11-14 13:33:09 +03:00
parent 2d0ca1c7bf
commit b4eff32427

View File

@ -58,6 +58,9 @@ def has_field(info, fieldname: str) -> bool:
def query_with_stat(info): def query_with_stat(info):
""" """
:param info: Информация о контексте GraphQL - для получения id авторизованного пользователя
:return: Запрос с подзапросами статистики.
Добавляет подзапрос статистики Добавляет подзапрос статистики
""" """
q = ( q = (
@ -164,12 +167,14 @@ def query_with_stat(info):
.subquery() .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_dict = info.context.get("author") if info.context else None
author_id = author_dict.get("id") if author_dict else None author_id = author_dict.get("id") if author_dict else None
logger.info(f"Current author_id: {author_id}")
if 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 = ( user_reaction_subquery = (
select( select(
Reaction.shout.label("shout_id"), Reaction.shout.label("shout_id"),