playlist.js 1020 B

123456789101112131415161718192021222324252627282930
  1. import mongoose from "mongoose";
  2. export default {
  3. displayName: { type: String, min: 2, max: 32, trim: true, required: true },
  4. songs: [
  5. {
  6. _id: { type: mongoose.Schema.Types.ObjectId },
  7. mediaSource: { type: String, required: true },
  8. title: { type: String },
  9. artists: [{ type: String }],
  10. duration: { type: Number },
  11. skipDuration: { type: Number },
  12. thumbnail: { type: String },
  13. verified: { type: Boolean }
  14. }
  15. ],
  16. createdBy: { type: String, required: true },
  17. createdAt: { type: Date, default: Date.now, required: true },
  18. createdFor: { type: String },
  19. privacy: { type: String, enum: ["public", "private"], default: "private" },
  20. type: { type: String, enum: ["user", "user-liked", "user-disliked", "genre", "station", "admin"], required: true },
  21. replacements: [
  22. {
  23. oldMediaSource: { type: String, required: true },
  24. newMediaSource: { type: String, required: true },
  25. replacedAt: { type: Date, required: true }
  26. }
  27. ],
  28. documentVersion: { type: Number, default: 7, required: true }
  29. };