Watch.js 1.8 KB

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