schema-inbox-fix

This commit is contained in:
2022-11-09 14:46:00 +03:00
parent 5bf3621724
commit b62211e05f
4 changed files with 15 additions and 15 deletions

View File

@@ -1,12 +1,12 @@
import asyncio
import json
import uuid
import asyncio
from datetime import datetime
from auth.authenticate import login_required
from base.redis import redis
from base.resolvers import mutation, query, subscription
from services.inbox import MessageResult, MessagesStorage, ChatFollowing
from services.inbox import ChatFollowing, MessageResult, MessagesStorage
async def get_unread_counter(chat_id: str, user_slug: str):
@@ -46,6 +46,11 @@ async def add_user_to_chat(user_slug: str, chat):
return chat
async def get_chats_by_user(slug: str):
chats = await redis.execute("GET", f"chats_by_user/{slug}")
return chats or []
@mutation.field("inviteChat")
async def invite_to_chat(_, info, invited: str, chat_id: str):
user = info.context["request"].user
@@ -124,11 +129,6 @@ async def load_messages(chatId: str, offset: int, amount: int):
}
async def get_chats_by_user(slug: str):
chats = await redis.execute("GET", f"chats_by_user/{slug}")
return chats or []
@query.field("myChats")
@login_required
async def user_chats(_, info):