station.js 3.0 KB

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