Watch.js 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var mongoose = require('mongoose');
  2. var schemaOptions = {
  3. timestamps: true,
  4. toJSON: {
  5. virtuals: true
  6. }
  7. };
  8. const getTags = tags => tags.join(', ');
  9. const setTags = tags => tags.split(', ');
  10. var watchSchema = new mongoose.Schema({
  11. permalink: {type: String, unique: true},
  12. criador: { type : mongoose.Schema.ObjectId, ref : 'User' },
  13. layout: String,
  14. title: String,
  15. subtitle: String,
  16. sinopse: String,
  17. year: Number,
  18. classind: String,
  19. duration: String,
  20. imgbg: String,
  21. video: String,
  22. thumb480: String,
  23. thumb130: String,
  24. runtime: String,
  25. tags: { type: [], get: getTags, set: setTags },
  26. featured: Boolean,
  27. n_eps: Number,
  28. eps: [{ last: Boolean,
  29. subtitle : String,
  30. video : String,
  31. thumb480 : String,
  32. thumb130 : String}]
  33. }, schemaOptions);
  34. var Watch = mongoose.model('Watch', watchSchema);
  35. module.exports = Watch;