This commit is contained in:
parent
33b1323630
commit
5c5cd4bf00
|
@ -70,7 +70,7 @@ type Query {
|
|||
|
||||
type Message {
|
||||
author: Int!
|
||||
chatId: String!
|
||||
chat_id: String!
|
||||
body: String!
|
||||
created_at: Int!
|
||||
id: Int!
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -32,7 +32,7 @@ async def create_message(_, info, chat_id: str, body: str, reply_to=None):
|
|||
chat_id = chat_dict['id']
|
||||
# Создание нового сообщения
|
||||
new_message: Message = {
|
||||
"chat": chat_id,
|
||||
"chat_id": chat_id,
|
||||
"id": message_id,
|
||||
"author": author_id,
|
||||
"body": body,
|
||||
|
@ -70,7 +70,7 @@ async def create_message(_, info, chat_id: str, body: str, reply_to=None):
|
|||
await redis.execute("LPUSH", f"chats/{chat_dict['id']}/unread/{member_id}", str(message_id))
|
||||
|
||||
# Отправка уведомления о новом сообщении
|
||||
new_message["chat"] = chat_id
|
||||
new_message["chat_id"] = chat_id
|
||||
await notify_message(new_message, "create")
|
||||
|
||||
return {"message": new_message, "error": None}
|
||||
|
@ -100,7 +100,7 @@ async def update_message(_, info, chat_id: str, message_id: int, body: str):
|
|||
|
||||
|
||||
# Отправка уведомления
|
||||
message["chat"] = chat_id
|
||||
message["chat_id"] = chat_id
|
||||
await notify_message(message, "update")
|
||||
|
||||
return {"message": message, "error": None}
|
||||
|
@ -130,7 +130,7 @@ async def delete_message(_, info, chat_id: str, message_id: int):
|
|||
for member_id in members:
|
||||
await redis.execute("LREM", f"chats/{chat_id}/unread/{member_id}", 0, str(message_id))
|
||||
|
||||
message["chat"] = chat_id
|
||||
message["chat_id"] = chat_id
|
||||
await notify_message(message, "delete")
|
||||
|
||||
return {}
|
||||
|
|
|
@ -3,7 +3,7 @@ from typing import TypedDict, Optional
|
|||
|
||||
class Message(TypedDict):
|
||||
id: int
|
||||
chat: str
|
||||
chat_id: str
|
||||
author: int
|
||||
body: str
|
||||
created_at: int
|
||||
|
|
Loading…
Reference in New Issue
Block a user