Watch.js 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. license: String,
  18. year: Number,
  19. classind: String,
  20. duration: String,
  21. imgbg: String,
  22. video: String,
  23. thumb480: String,
  24. thumb130: String,
  25. runtime: String,
  26. tags: { type: [], get: getTags, set: setTags },
  27. featured: String,
  28. top: String,
  29. n_eps: Number,
  30. eps: [{ last: Boolean,
  31. subtitle : String,
  32. video : String,
  33. thumb480 : String,
  34. thumb130 : String}]
  35. }, schemaOptions);
  36. var Watch = mongoose.model('Watch', watchSchema);
  37. module.exports = Watch;