station.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. module.exports = function(mongoose) {
  2. var Schema = mongoose.Schema;
  3. var stationSchema = new Schema({
  4. _id: { type: String, lowercase: true, max: 16, min: 2, index: true, unique: true, required: true },
  5. type: { type: String, enum: ["official", "community"], required: true},
  6. displayName: { type: String, min: 2, max: 32, required: true },
  7. description: { type: String, min: 2, max: 128, required: true },
  8. privacy: { type: String, enum: ["public", "unlisted", "private"], required: true },
  9. paused: { type: Boolean, default: false, required: true },
  10. currentSong: {
  11. startedAt: { type: Number, required: true },
  12. id: { type: String, length: 11, required: true },
  13. title: { type: String, required: true },
  14. artists: [{ type: String, min: 1 }],
  15. duration: { type: Number, required: true },
  16. skipDuration: { type: Number, required: true },
  17. image: { type: String, required: true },
  18. likes: { type: Number, required: true },
  19. dislikes: { type: Number, required: true },
  20. genres: [{ type: String }]
  21. },
  22. timePaused: { type: Number, default: 0, required: true },
  23. playlist: { type: String, required: true },
  24. genres: [{ type: String }],
  25. whitelist: [{ type: String }],
  26. partyMode: { type: Boolean, default: false, required: true },
  27. queueLocked: { type: Boolean, default: false, required: true },
  28. owner: { type: String }
  29. });
  30. return mongoose.model('station', stationSchema);
  31. };