station.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import mongoose from "mongoose";
  2. export default {
  3. name: { type: String, lowercase: true, maxlength: 16, minlength: 2, index: true, unique: true, required: true },
  4. type: { type: String, enum: ["official", "community"], required: true },
  5. displayName: { type: String, minlength: 2, maxlength: 32, required: true, unique: true },
  6. description: { type: String, minlength: 2, maxlength: 128, required: true },
  7. paused: { type: Boolean, default: false, required: true },
  8. currentSong: {
  9. _id: { type: String },
  10. youtubeId: { type: String },
  11. title: { type: String },
  12. artists: [{ type: String }],
  13. duration: { type: Number },
  14. skipDuration: { type: Number },
  15. thumbnail: { type: String },
  16. likes: { type: Number, default: -1 },
  17. dislikes: { type: Number, default: -1 },
  18. skipVotes: [{ type: String }],
  19. requestedBy: { type: String },
  20. requestedAt: { type: Date },
  21. status: { type: String }
  22. },
  23. currentSongIndex: { type: Number, default: 0, required: true },
  24. timePaused: { type: Number, default: 0, required: true },
  25. pausedAt: { type: Number, default: 0, required: true },
  26. startedAt: { type: Number, default: 0, required: true },
  27. playlist: { type: mongoose.Schema.Types.ObjectId, required: true },
  28. privacy: { type: String, enum: ["public", "unlisted", "private"], default: "private" },
  29. locked: { type: Boolean, default: false },
  30. queue: [
  31. {
  32. youtubeId: { type: String, required: true },
  33. title: { type: String },
  34. artists: [{ type: String }],
  35. duration: { type: Number },
  36. skipDuration: { type: Number },
  37. thumbnail: { type: String },
  38. likes: { type: Number },
  39. dislikes: { type: Number },
  40. requestedBy: { type: String },
  41. requestedAt: { type: Date },
  42. status: { type: String }
  43. }
  44. ],
  45. owner: { type: String },
  46. partyMode: { type: Boolean },
  47. playMode: { type: String, enum: ["random", "sequential"], default: "random" },
  48. theme: { type: String, enum: ["blue", "purple", "teal", "orange"], default: "blue" },
  49. includedPlaylists: [{ type: String }],
  50. excludedPlaylists: [{ type: String }],
  51. documentVersion: { type: Number, default: 5, required: true }
  52. };