Watch.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /* Internal */
  12. permalink: {type: String, unique: true},
  13. criador: { type : mongoose.Schema.ObjectId, ref : 'User' },
  14. layout: String,
  15. featured: String,
  16. top: String,
  17. /* Basic */
  18. title: String,
  19. subtitle: String,
  20. original_title: String,
  21. year: Number,
  22. duration: String,
  23. classind: String,
  24. sinopse: String,
  25. /* More Info */
  26. description: String,
  27. license: String,
  28. location: {
  29. country: String,
  30. state: String,
  31. city: String,
  32. lat: String,
  33. lon: String
  34. },
  35. crew: {
  36. director: { type: [], get: getTags, set: setTags },
  37. screenplay: { type: [], get: getTags, set: setTags },
  38. producer: { type: [], get: getTags, set: setTags },
  39. cast: { type: [], get: getTags, set: setTags },
  40. editor: { type: [], get: getTags, set: setTags },
  41. other: String,
  42. },
  43. /* Images */
  44. imgbg: String,
  45. thumb480: String,
  46. thumb130: String,
  47. /* Video */
  48. video: String,
  49. trailer: String,
  50. quality: String,
  51. audio_language: String,
  52. srt_language: { type: [], get: getTags, set: setTags },
  53. /* Files and Download*/
  54. file: {
  55. film: String,
  56. trailer: String,
  57. srt: String
  58. },
  59. /* Categories */
  60. tags: { type: [], get: getTags, set: setTags },
  61. /* For Series */
  62. n_eps: Number,
  63. eps: [{ last: Boolean,
  64. subtitle : String,
  65. video : String,
  66. thumb480 : String,
  67. thumb130 : String}]
  68. }, schemaOptions);
  69. var Watch = mongoose.model('Watch', watchSchema);
  70. module.exports = Watch;