more-fixes

This commit is contained in:
Untone 2023-10-11 22:41:40 +03:00
parent 8cac67986c
commit 8c87457a09
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ async def create_message(_, info, chat: str, body: str, reply_to=None):
if not chat: if not chat:
return {"error": "chat is not exist"} return {"error": "chat is not exist"}
else: else:
chat = dict(json.loads(chat)) chat = vars(json.loads(chat))
message_id = await redis.execute("GET", f"chats/{chat['id']}/next_message_id") message_id = await redis.execute("GET", f"chats/{chat['id']}/next_message_id")
message_id = int(message_id) message_id = int(message_id)
new_message = { new_message = {

View File

@ -7,7 +7,7 @@ from services.auth import login_required
async def get_unread_counter(chat_id: str, author_id: int): async def get_unread_counter(chat_id: str, author_id: int):
try: try:
unread = await redis.execute( unread = await redis.execute(
"LLEN", f"chats/{chat_id.decode('utf-8')}/unread/{author_id}" "LLEN", f"chats/{chat_id}/unread/{author_id}"
) )
if unread: if unread:
return unread return unread