fix: share chat permission issue

This commit is contained in:
Timothy J. Baek 2024-04-07 01:21:12 -07:00
parent eb5ed905eb
commit f64ac3269f
2 changed files with 21 additions and 1 deletions

View file

@ -206,6 +206,18 @@ class ChatTable:
except:
return None
def get_chat_by_share_id(self, id: str) -> Optional[ChatModel]:
try:
chat = Chat.get(Chat.share_id == id)
if chat:
chat = Chat.get(Chat.id == id)
return ChatModel(**model_to_dict(chat))
else:
return None
except:
return None
def get_chat_by_id_and_user_id(self, id: str, user_id: str) -> Optional[ChatModel]:
try:
chat = Chat.get(Chat.id == id, Chat.user_id == user_id)