convo successfully changes on convo click

This commit is contained in:
Daniel Avila 2023-02-06 18:25:11 -05:00
parent d35ed31b20
commit c7c50dbbab
9 changed files with 76 additions and 25 deletions

View file

@ -1,5 +1,5 @@
const mongoose = require('mongoose');
const { Message } = require('./Message');
const { getMessages } = require('./Message');
const convoSchema = mongoose.Schema({
conversationId: {
@ -27,7 +27,7 @@ const Conversation =
module.exports = {
saveConversation: async ({ conversationId, parentMessageId, title }) => {
const messages = await Message.find({ conversationId }).exec();
const messages = await getMessages({ conversationId });
const update = { parentMessageId, messages };
if (title) {
update.title = title;