station.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. type: {
  10. _id: { type: mongoose.Schema.Types.ObjectId },
  11. mediaSource: { type: String },
  12. title: { type: String },
  13. artists: [{ type: String }],
  14. duration: { type: Number },
  15. skipDuration: { type: Number },
  16. thumbnail: { type: String },
  17. skipVotes: [{ type: String }],
  18. requestedBy: { type: String },
  19. requestedAt: { type: Date },
  20. requestedType: { type: String, enum: ["manual", "autorequest", "autofill"] },
  21. verified: { type: Boolean }
  22. },
  23. default: null
  24. },
  25. currentSongIndex: { type: Number, default: 0, required: true },
  26. timePaused: { type: Number, default: 0, required: true },
  27. pausedAt: { type: Number, default: 0, required: true },
  28. startedAt: { type: Number, default: 0, required: true },
  29. playlist: { type: mongoose.Schema.Types.ObjectId, required: true },
  30. privacy: { type: String, enum: ["public", "unlisted", "private"], default: "private" },
  31. queue: [
  32. {
  33. _id: { type: mongoose.Schema.Types.ObjectId },
  34. mediaSource: { type: String, required: true },
  35. title: { type: String },
  36. artists: [{ type: String }],
  37. duration: { type: Number },
  38. skipDuration: { type: Number },
  39. thumbnail: { type: String },
  40. requestedBy: { type: String },
  41. requestedAt: { type: Date },
  42. requestedType: { type: String, enum: ["manual", "autorequest", "autofill"] },
  43. verified: { type: Boolean }
  44. }
  45. ],
  46. owner: { type: String },
  47. requests: {
  48. enabled: { type: Boolean, default: true },
  49. access: { type: String, enum: ["owner", "user"], default: "owner" },
  50. limit: { type: Number, min: 1, max: 50, default: 5 },
  51. allowAutorequest: { type: Boolean, default: true, required: true },
  52. autorequestLimit: { type: Number, min: 1, max: 50, default: 3, required: true },
  53. autorequestDisallowRecentlyPlayedEnabled: { type: Boolean, default: true, required: true },
  54. autorequestDisallowRecentlyPlayedNumber: { type: Number, min: 1, max: 250, default: 50, required: true }
  55. },
  56. autofill: {
  57. enabled: { type: Boolean, default: true },
  58. playlists: [{ type: mongoose.Schema.Types.ObjectId, ref: "playlists" }],
  59. limit: { type: Number, min: 1, max: 50, default: 30 },
  60. mode: { type: String, enum: ["random", "sequential"], default: "random" }
  61. },
  62. theme: { type: String, enum: ["blue", "purple", "teal", "orange", "red"], default: "blue" },
  63. blacklist: [{ type: mongoose.Schema.Types.ObjectId, ref: "playlists" }],
  64. djs: [{ type: mongoose.Schema.Types.ObjectId, ref: "users" }],
  65. skipVoteThreshold: { type: Number, min: 0, max: 100, default: 50, required: true },
  66. documentVersion: { type: Number, default: 10, required: true }
  67. };