quivr/backend/repository/chat/get_user_chats.py
2023-06-28 19:39:27 +02:00

18 lines
461 B
Python

from typing import List
from models.chat import Chat
from models.settings import common_dependencies
def get_user_chats(user_id: str) -> List[Chat]:
commons = common_dependencies()
response = (
commons["supabase"]
.from_("chats")
.select("chat_id,user_id,creation_time,chat_name")
.filter("user_id", "eq", user_id)
.execute()
)
chats = [Chat(chat_dict) for chat_dict in response.data]
return chats