actions-notify
All checks were successful
deploy / deploy (push) Successful in 1m9s

This commit is contained in:
2023-10-19 17:43:20 +03:00
parent d25b406b60
commit c6ad0414b0
2 changed files with 9 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ async def create_message(_, info, chat: str, body: str, reply_to=None):
await redis.execute("LPUSH", f"chats/{chat_dict['id']}/unread/{member_id}", str(message_id))
# Отправка уведомления о новом сообщении
await notify_message(new_message, chat_dict["id"])
await notify_message(new_message, chat_dict["id"], "create")
return {"message": new_message, "error": None}
@@ -99,6 +99,7 @@ async def update_message(_, info, chat_id: str, message_id: int, body: str):
await redis.execute("SET", f"chats/{chat_id}/messages/{message_id}", json.dumps(message))
# TODO: use presence service to notify about updated message
await notify_message(message, chat_id, "update")
return {"message": message, "error": None}
@@ -128,6 +129,7 @@ async def delete_message(_, info, chat_id: str, message_id: int):
await redis.execute("LREM", f"chats/{chat_id}/unread/{member_id}", 0, str(message_id))
# TODO: use presence service to notify about deleted message
await notify_message(message, chat_id, "delete")
return {}
@@ -149,4 +151,7 @@ async def mark_as_read(_, info, chat_id: str, messages: List[int]):
for message_id in messages:
await redis.execute("LREM", f"chats/{chat_id}/unread/{author_id}", 0, str(message_id))
# TODO: seen per author
# await notify_message(message, chat_id, "seen")
return {"error": None}