user.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import mongoose from "mongoose";
  2. export default {
  3. username: { type: String, required: true },
  4. role: { type: String, default: "default", required: true },
  5. email: {
  6. verified: { type: Boolean, default: false, required: true },
  7. verificationToken: String,
  8. address: String
  9. },
  10. avatar: {
  11. type: { type: String, enum: ["gravatar", "initials"], required: true },
  12. url: { type: String, required: false },
  13. color: { type: String, enum: ["blue", "orange", "green", "purple", "teal"], required: false }
  14. },
  15. services: {
  16. password: {
  17. password: String,
  18. reset: {
  19. code: { type: String, min: 8, max: 8 },
  20. expires: { type: Date }
  21. },
  22. set: {
  23. code: { type: String, min: 8, max: 8 },
  24. expires: { type: Date }
  25. }
  26. },
  27. github: {
  28. id: Number,
  29. access_token: String
  30. }
  31. },
  32. statistics: {
  33. songsRequested: { type: Number, default: 0, required: true }
  34. },
  35. likedSongsPlaylist: { type: mongoose.Schema.Types.ObjectId },
  36. dislikedSongsPlaylist: { type: mongoose.Schema.Types.ObjectId },
  37. favoriteStations: [{ type: String }],
  38. name: { type: String, required: true },
  39. location: { type: String, default: "" },
  40. bio: { type: String, default: "" },
  41. createdAt: { type: Date, default: Date.now },
  42. preferences: {
  43. orderOfPlaylists: [{ type: mongoose.Schema.Types.ObjectId }],
  44. nightmode: { type: Boolean, default: false, required: true },
  45. autoSkipDisliked: { type: Boolean, default: true, required: true },
  46. activityLogPublic: { type: Boolean, default: false, required: true },
  47. anonymousSongRequests: { type: Boolean, default: false, required: true },
  48. activityWatch: { type: Boolean, default: false, required: true }
  49. },
  50. documentVersion: { type: Number, default: 3, required: true }
  51. };