inbox-debug-6

This commit is contained in:
Untone 2024-01-24 15:00:28 +03:00
parent a83ef022a3
commit cccaf16817
2 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ async def update_chat(_, info, chat_new: ChatUpdate):
:param chat_new: dict with chat data
:return: Result { error chat }
"""
logger.info("update_chat")
author_id = info.context["author_id"]
chat_id = chat_new["id"]
chat_str = await redis.execute("GET", f"chats/{chat_id}")
@ -52,6 +53,7 @@ async def update_chat(_, info, chat_new: ChatUpdate):
@mutation.field("create_chat")
@login_required
async def create_chat(_, info, title="", members=None):
logger.info("create_chat")
members = members or []
author_id = info.context["author_id"]
chat: Chat
@ -98,6 +100,7 @@ async def create_chat(_, info, title="", members=None):
@mutation.field("delete_chat")
@login_required
async def delete_chat(_, info, chat_id: str):
logger.info("delete_chat")
author_id = info.context["author_id"]
chat_str = await redis.execute("GET", f"chats/{chat_id}")
if isinstance(chat_str, str):

View File

@ -115,6 +115,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
@login_required
async def load_messages_by(_, info, by, limit: int = 10, offset: int = 0):
"""load :limit messages of :chat_id with :offset"""
logger.info("load_messages_by")
author_id = info.context["author_id"]
author_chats = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
try: