|
@@ -235,6 +235,24 @@ class ChatTable:
|
|
chat["history"] = history
|
|
chat["history"] = history
|
|
return self.update_chat_by_id(id, chat)
|
|
return self.update_chat_by_id(id, chat)
|
|
|
|
|
|
|
|
+ def add_message_status_to_chat_by_id_and_message_id(
|
|
|
|
+ self, id: str, message_id: str, status: dict
|
|
|
|
+ ) -> Optional[ChatModel]:
|
|
|
|
+ chat = self.get_chat_by_id(id)
|
|
|
|
+ if chat is None:
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+ chat = chat.chat
|
|
|
|
+ history = chat.get("history", {})
|
|
|
|
+
|
|
|
|
+ if message_id in history.get("messages", {}):
|
|
|
|
+ status_history = history["messages"][message_id].get("statusHistory", [])
|
|
|
|
+ status_history.append(status)
|
|
|
|
+ history["messages"][message_id]["statusHistory"] = status_history
|
|
|
|
+
|
|
|
|
+ chat["history"] = history
|
|
|
|
+ return self.update_chat_by_id(id, chat)
|
|
|
|
+
|
|
def insert_shared_chat_by_chat_id(self, chat_id: str) -> Optional[ChatModel]:
|
|
def insert_shared_chat_by_chat_id(self, chat_id: str) -> Optional[ChatModel]:
|
|
with get_db() as db:
|
|
with get_db() as db:
|
|
# Get the existing chat to share
|
|
# Get the existing chat to share
|