-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecipe.js
50 lines (47 loc) · 969 Bytes
/
Recipe.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
const mongoose = require('mongoose');
const RecipeSchema = new mongoose.Schema(
{
recipeName: {
type: String,
required: true,
unique: true,
},
recipeNameSpanish: {
type: String,
},
path: String,
author: {
type: String,
required: true,
},
linkToSource: {
type: String,
default: null,
},
image: String,
cloudinaryId: String,
ingredients: [mongoose.Schema.Types.Mixed],
instructions: [
{
type: String,
},
],
cuisine: String,
specialDiet: String,
allergens: String,
recipeType: String,
cookTime: String,
prepTime: String,
totalTime: String,
description: String,
servings: String,
},
{ timestamps: true }
);
let collection;
if (process.env.NODE_ENV === 'development') {
collection = 'devRecipes';
} else {
collection = 'Recipes';
}
module.exports = mongoose.model('Recipe', RecipeSchema, collection);