summaryrefslogtreecommitdiff
path: root/models/recipe.js
blob: e866f5f829fb269c6326b433bb0056c1d2881078 (plain)
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
const mongoose = require('mongoose');

const recipeSchema = new mongoose.Schema({
    title: String,
    picture: String, 
    category: String,
    ingridients: [String, String],
    isLiked: Number,
    steps: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Step'
        }
    ],
    author: {
        id: {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'User'
        },
        username: String
    },
    comments: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Cmmnt'
        }
    ]
});

module.exports = new mongoose.model('Recipe', recipeSchema);