chore: model menu functions behave as expected

This commit is contained in:
Danny Avila 2023-03-07 13:19:56 -05:00
parent 191118b90b
commit 6be037323e
9 changed files with 157 additions and 35 deletions

View file

@ -60,6 +60,17 @@ module.exports = {
return { message: 'Error updating customGpt' };
}
},
updateByLabel: async ({ prevLabel, ...update }) => {
try {
return await CustomGpt.findOneAndUpdate({ chatGptLabel: prevLabel }, update, {
new: true,
upsert: true
}).exec();
} catch (error) {
console.log(error);
return { message: 'Error updating customGpt' };
}
},
deleteCustomGpts: async (filter) => {
try {
return await CustomGpt.deleteMany(filter).exec();