fix-chat-id
All checks were successful
deploy / deploy (push) Successful in 1m14s

This commit is contained in:
Untone 2023-11-17 08:00:57 +03:00
parent 5c5cd4bf00
commit 31a8536d27
3 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ async def create_chat(_, info, title="", members=None):
return {"chat": chat, "error": "existed"} return {"chat": chat, "error": "existed"}
chat_id = str(uuid.uuid4()) chat_id = str(uuid.uuid4())
: Chat = { chat: Chat = {
"id": chat_id, "id": chat_id,
"members": members, "members": members,
"title": title, "title": title,

View File

@ -63,7 +63,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
if len(cids) == 0: if len(cids) == 0:
print(f"[resolvers.load] no chats for user with id={author_id}") print(f"[resolvers.load] no chats for user with id={author_id}")
r = await create_chat(None, info, members=[2]) # member with id = 2 is discours r = await create_chat(None, info, members=[2]) # member with id = 2 is discours
print(f"[resolvers.load] created chat: {r['chat']}") print(f"[resolvers.load] created chat: {r['chat_id']}")
cids.append(r["chat"]["id"]) cids.append(r["chat"]["id"])
all_authors: List[ChatMember] = await get_all_authors() all_authors: List[ChatMember] = await get_all_authors()
authors = {a["id"]: a for a in all_authors} authors = {a["id"]: a for a in all_authors}

View File

@ -5,7 +5,7 @@ from validators.chat import Message, ChatUpdate
async def notify_message(message: Message, action="create"): async def notify_message(message: Message, action="create"):
channel_name = f"message:{message["chat"]}" channel_name = f"message:{message["chat_id"]}"
data = {"payload": message, "action": action} data = {"payload": message, "action": action}
try: try:
await redis.publish(channel_name, json.dumps(data)) await redis.publish(channel_name, json.dumps(data))