create-msg-fix
This commit is contained in:
parent
3e1fd78ebe
commit
3959a36d8a
|
@ -10,7 +10,7 @@ from services.schema import mutation
|
|||
|
||||
@mutation.field("createMessage")
|
||||
@login_required
|
||||
async def create_message(_, info, chat: str, body: str, reply_to=None):
|
||||
async def create_message(_, info, chat_id: str, body: str, reply_to=None):
|
||||
"""
|
||||
create message with
|
||||
:body for
|
||||
|
@ -19,11 +19,11 @@ async def create_message(_, info, chat: str, body: str, reply_to=None):
|
|||
"""
|
||||
author_id = info.context["author_id"]
|
||||
|
||||
chat_dict = await redis.execute("GET", f"chats/{chat}")
|
||||
if not chat_dict:
|
||||
chat_data = await redis.execute("GET", f"chats/{chat_id}")
|
||||
if not chat_data:
|
||||
return {"error": "chat is not exist"}
|
||||
else:
|
||||
chat_dict = vars(json.loads(chat))
|
||||
chat_dict = json.loads(chat_data)
|
||||
message_id = (await redis.execute("GET", f"chats/{chat_dict['id']}/next_message_id")) or 0
|
||||
message_id = int(message_id)
|
||||
new_message = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user