|
|
@@ -335,38 +335,38 @@ module.exports = {
|
|
|
}
|
|
|
|
|
|
//Create Recipes
|
|
|
- let merchant = {};
|
|
|
- let newRecipes = [];
|
|
|
- return Merchant.findOne({_id: user})
|
|
|
- .then((response)=>{
|
|
|
- merchant = response;
|
|
|
-
|
|
|
- let recipes = [];
|
|
|
- for(let i = 1; i < array.length; i++){
|
|
|
- recipes.push({
|
|
|
- name: array[i][locations.name],
|
|
|
- price: parseInt(array[i][locations.price] * 100),
|
|
|
- merchant: merchant
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- return Recipe.create(recipes)
|
|
|
- })
|
|
|
- .then((recipes)=>{
|
|
|
- for(let i = 0; i < recipes.length; i++){
|
|
|
- merchant.recipes.push(recipes[i]);
|
|
|
-
|
|
|
- recipes[i].merchant = undefined;
|
|
|
- newRecipes.push(recipes[i]);
|
|
|
- }
|
|
|
-
|
|
|
- return merchant.save();
|
|
|
- })
|
|
|
- .then((merchant)=>{
|
|
|
- return newRecipes;
|
|
|
- })
|
|
|
- .catch((err)=>{
|
|
|
- return "ERROR: UNABLE TO CREATE RECIPES";
|
|
|
- });
|
|
|
+ // let merchant = {};
|
|
|
+ // let newRecipes = [];
|
|
|
+ // return Merchant.findOne({_id: req.session.user})
|
|
|
+ // .then((response)=>{
|
|
|
+ // merchant = response;
|
|
|
+
|
|
|
+ // let recipes = [];
|
|
|
+ // for(let i = 1; i < array.length; i++){
|
|
|
+ // recipes.push({
|
|
|
+ // name: array[i][locations.name],
|
|
|
+ // price: parseInt(array[i][locations.price] * 100),
|
|
|
+ // merchant: merchant
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // return Recipe.create(recipes)
|
|
|
+ // })
|
|
|
+ // .then((recipes)=>{
|
|
|
+ // for(let i = 0; i < recipes.length; i++){
|
|
|
+ // merchant.recipes.push(recipes[i]);
|
|
|
+
|
|
|
+ // recipes[i].merchant = undefined;
|
|
|
+ // newRecipes.push(recipes[i]);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // return merchant.save();
|
|
|
+ // })
|
|
|
+ // .then((merchant)=>{
|
|
|
+ // return newRecipes;
|
|
|
+ // })
|
|
|
+ // .catch((err)=>{
|
|
|
+ // return "ERROR: UNABLE TO CREATE RECIPES";
|
|
|
+ // });
|
|
|
}
|
|
|
}
|