station.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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, trim: true, required: true, unique: true },
  6. description: { type: String, minlength: 2, maxlength: 128, trim: true, required: true },
  7. paused: { type: Boolean, default: false, required: true },
  8. currentSong: {
  9. _id: { type: mongoose.Schema.Types.ObjectId },
  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. skipVotes: [{ type: String }],
  17. requestedBy: { type: String },
  18. requestedAt: { type: Date },
  19. verified: { type: Boolean }
  20. },
  21. currentSongIndex: { type: Number, default: 0, required: true },
  22. timePaused: { type: Number, default: 0, required: true },
  23. pausedAt: { type: Number, default: 0, required: true },
  24. startedAt: { type: Number, default: 0, required: true },
  25. playlist: { type: mongoose.Schema.Types.ObjectId, required: true },
  26. privacy: { type: String, enum: ["public", "unlisted", "private"], default: "private" },
  27. queue: [
  28. {
  29. _id: { type: mongoose.Schema.Types.ObjectId },
  30. youtubeId: { type: String, required: true },
  31. title: { type: String },
  32. artists: [{ type: String }],
  33. duration: { type: Number },
  34. skipDuration: { type: Number },
  35. thumbnail: { type: String },
  36. requestedBy: { type: String },
  37. requestedAt: { type: Date },
  38. verified: { type: Boolean }
  39. }
  40. ],
  41. owner: { type: String },
  42. requests: {
  43. enabled: { type: Boolean, default: true },
  44. access: { type: String, enum: ["owner", "user"], default: "owner" },
  45. limit: { type: Number, min: 1, max: 50, default: 5 }
  46. },
  47. autofill: {
  48. enabled: { type: Boolean, default: true },
  49. playlists: [{ type: mongoose.Schema.Types.ObjectId, ref: "playlists" }],
  50. limit: { type: Number, min: 1, max: 50, default: 30 },
  51. mode: { type: String, enum: ["random", "sequential"], default: "random" }
  52. },
  53. theme: { type: String, enum: ["blue", "purple", "teal", "orange", "red"], default: "blue" },
  54. blacklist: [{ type: mongoose.Schema.Types.ObjectId, ref: "playlists" }],
  55. documentVersion: { type: Number, default: 8, required: true }
  56. };