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.

37 lines
1.1 KiB

7 years ago
  1. var mongoose = require('mongoose');
  2. var mongooseUniqueValidator = require('mongoose-unique-validator');
  3. var Schema = mongoose.Schema;
  4. var routineSchema = new Schema({
  5. title: {type: String},
  6. description: {type: String},
  7. startingDay: {type: Date},
  8. discipline: {type: String},
  9. price: { type: Number },//si és gratis, es posa q val 0, així els users ho veuen amb bons ulls
  10. image: { type: String },
  11. client: {
  12. type: mongoose.Schema.Types.ObjectId,
  13. ref: 'userModel'
  14. },
  15. trainer: {
  16. type: mongoose.Schema.Types.ObjectId,
  17. ref: 'userModel'
  18. },
  19. days: [{
  20. title: {type: String},
  21. description: {type: String},
  22. exercises: [{
  23. title: {type: String},
  24. description: {type: String},
  25. img: {type: String},
  26. weight: {type: String},
  27. distance: {type: String},
  28. reps: {type: String},
  29. series: {type: String}
  30. }],
  31. done: {type: String, default: false}//si ha complert el dia
  32. }]
  33. })
  34. ;
  35. routineSchema.plugin(mongooseUniqueValidator);
  36. module.exports = mongoose.model('routineModel', routineSchema);