load convos on message send & other conditional rendering

This commit is contained in:
Danny Avila 2023-02-06 16:00:59 -05:00
parent 2869638cc0
commit c794287ced
7 changed files with 39 additions and 20 deletions

View file

@ -27,7 +27,7 @@ const Conversation =
module.exports = {
saveConversation: async ({ conversationId, parentMessageId, title }) => {
const messages = await Message.find({ conversationId });
const messages = await Message.find({ conversationId }).exec();
const update = { parentMessageId, messages };
if (title) {
update.title = title;
@ -39,7 +39,5 @@ module.exports = {
{ new: true, upsert: true }
).exec();
},
getConversations: async () => {
return await Conversation.find({}).exec();
},
getConversations: async () => await Conversation.find({}).exec(),
};