This commit is contained in:
parent
5c5cd4bf00
commit
31a8536d27
|
@ -68,7 +68,7 @@ async def create_chat(_, info, title="", members=None):
|
|||
return {"chat": chat, "error": "existed"}
|
||||
|
||||
chat_id = str(uuid.uuid4())
|
||||
: Chat = {
|
||||
chat: Chat = {
|
||||
"id": chat_id,
|
||||
"members": members,
|
||||
"title": title,
|
||||
|
|
|
@ -63,7 +63,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
|
|||
if len(cids) == 0:
|
||||
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
|
||||
print(f"[resolvers.load] created chat: {r['chat']}")
|
||||
print(f"[resolvers.load] created chat: {r['chat_id']}")
|
||||
cids.append(r["chat"]["id"])
|
||||
all_authors: List[ChatMember] = await get_all_authors()
|
||||
authors = {a["id"]: a for a in all_authors}
|
||||
|
|
|
@ -5,7 +5,7 @@ from validators.chat import Message, ChatUpdate
|
|||
|
||||
|
||||
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}
|
||||
try:
|
||||
await redis.publish(channel_name, json.dumps(data))
|
||||
|
|
Loading…
Reference in New Issue
Block a user