Fix bug with creating meal list
This commit is contained in:
parent
a96c1d9c07
commit
9a4f1038ff
@ -4,7 +4,8 @@ const ApiError = require('../utils/ApiError');
|
||||
|
||||
const createMeal = async (mealBody) => {
|
||||
const meal = await Meal.create(mealBody);
|
||||
return meal;
|
||||
const mealWithProducts = await meal.populate('products.product').execPopulate();
|
||||
return mealWithProducts;
|
||||
};
|
||||
|
||||
const queryMeals = async (filter, options) => {
|
||||
@ -38,7 +39,8 @@ const updateMealById = async (mealId, updateBody) => {
|
||||
}
|
||||
Object.assign(meal, updateBody);
|
||||
await meal.save();
|
||||
return meal;
|
||||
const mealWithProducts = await meal.populate('products.product').execPopulate();
|
||||
return mealWithProducts;
|
||||
};
|
||||
|
||||
const updateMealProductsById = async (mealId, updateBody) => {
|
||||
|
Loading…
Reference in New Issue
Block a user