-
Notifications
You must be signed in to change notification settings - Fork 2
/
seed.js
97 lines (89 loc) · 2.62 KB
/
seed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// var db = require("./models");
var db = require("./models");
const NUM_OF_TIME_SLOTS = 28;
var sampleIngredientsArr = [
{
ingredientName: 'apple',
qty: 1/2,
measuringUnit: 'whole'
},
{
ingredientName: 'orange',
qty: 2,
measuringUnit: 'whole'
}
];
console.log('sampleIngredientsArr:', sampleIngredientsArr)
// POPULATE RECIPES
var sampleRecipesArr = [
{
recipeName: 'Eggs & Hashbrowns',
servingSize: 1,
ingredients: sampleIngredientsArr,
prepInstructions: 'Cook hashbrowns at high heat on stovetop. Fry eggs over-easy. Add tobasco.',
prepTime: '0 minutes',
cookTime: '20 minutes',
mealType: 'Breakfast',
activeCount: 0
},
{
recipeName: 'BLT',
servingSize: 1,
ingredients: sampleIngredientsArr,
prepInstructions: 'Chop lettuce & tomato. Cook bacon. Toast bread. Spread mayo on bread, and place bacon, lettuce, & tomato.',
prepTime: '15 minutes',
cookTime: '5 minutes',
mealType: 'Lunch',
activeCount: 0
},
{
recipeName: 'Chicken Enchiladas',
servingSize: 1,
ingredients: sampleIngredientsArr,
prepInstructions: 'Boil chicken. Prep sauce concoction. Spread across six tortillas. Roll and place tortillas in baking pan, then cook in oven at 400 degrees for 45 minutes.',
prepTime: '15 minutes',
cookTime: '30 minutes',
mealType: 'Dinner',
activeCount: 0
},
{
recipeName: 'Chicken Pesto Pasta',
servingSize: 1,
ingredients: sampleIngredientsArr,
prepInstructions: 'Placeholder prep instructions',
prepTime: '30 minutes',
cookTime: '15 minutes',
mealType: 'Dinner',
activeCount: 0
},
{
recipeName: 'Molten Lava Chocolate Cake',
servingSize: 1,
ingredients: sampleIngredientsArr,
prepInstructions: 'Placeholder prep instructions',
prepTime: '25 minutes',
cookTime: '20 minutes',
mealType: 'Dessert',
activeCount: 0
}
];
console.log('sampleRecipesArr:', sampleRecipesArr);
// POPULATE MEALPLAN
var mealPlanArr = [];
for (let i = 0; i < NUM_OF_TIME_SLOTS; i++) {
mealPlanArr.push('');
}
mealPlanArr[0] = sampleRecipesArr[0].recipeName;
mealPlanArr[10] = sampleRecipesArr[1].recipeName;
mealPlanArr[14] = sampleRecipesArr[2].recipeName;
mealPlanArr[20] = sampleRecipesArr[3].recipeName;
mealPlanArr[27] = sampleRecipesArr[4].recipeName;
console.log('mealPlan:', mealPlanArr);
// POPULATE USER RECORD WITH RECIPES AND MEALPLAN
db.User.findOneAndUpdate({ _id: '5adfc0b829ea87c828775298'}, { recipes: sampleRecipesArr, mealPlan: mealPlanArr }, function(err, user) {
if (err) {
return console.log('err:', err);
} else {
console.log('db seeded :)');
}
});