You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
1.5 KiB

var mongoose = require('mongoose');
var mongooseUniqueValidator = require('mongoose-unique-validator');
var Schema = mongoose.Schema;
var dietSchema = new Schema({
title: {type: String},
description: {type: String},
startingDay: {type: Date},
price: { type: Number },
image: { type: String },
clients: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'userModel'
}],
chef: {
type: mongoose.Schema.Types.ObjectId,
ref: 'userModel'
},
days: [{
date: {type: Date}, //Ha de ser realmente un día que empiezas por ejemplo 12/12/2016 para poder ir completando según la fecha, comer comes cada día
title: {type: String},
description: {type: String},
meals: [{
title: {type: String},
img: {type: String},
submeals: [{
title: {type: String},
description: {type: String},
amount: {
unit: {type: String},
quantity: {type: Number}
},
nutritional: {
kcal: {type: Number},
proteins: {type: Number},
carbohidrates: {type: Number},
fats: {type: Number},
vitamins: {type: Number}
}
}]
}],
done: {type: Boolean, default: false}
}]
});
dietSchema.plugin(mongooseUniqueValidator);
module.exports = mongoose.model('dietModel', dietSchema);