user.js 998 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module.exports = {
  2. username: { type: String, required: true },
  3. role: { type: String, default: 'default', required: true },
  4. email: {
  5. verified: { type: Boolean, default: false, required: true },
  6. verificationToken: String,
  7. address: String
  8. },
  9. avatar: {
  10. type: { type: String, enum: ["gravatar", "initials"] },
  11. url: { type: String, required: false }
  12. },
  13. services: {
  14. password: {
  15. password: String,
  16. reset: {
  17. code: { type: String, min: 8, max: 8 },
  18. expires: { type: Date }
  19. },
  20. set: {
  21. code: { type: String, min: 8, max: 8 },
  22. expires: { type: Date }
  23. }
  24. },
  25. github: {
  26. id: Number,
  27. access_token: String
  28. }
  29. },
  30. statistics: {
  31. songsRequested: { type: Number, default: 0, required: true }
  32. },
  33. liked: [{ type: String }],
  34. disliked: [{ type: String }],
  35. favoriteStations: [{ type: String }],
  36. name: { type: String, default: "" },
  37. location: { type: String, default: "" },
  38. bio: { type: String, default: "" },
  39. createdAt: { type: Date, default: Date.now }
  40. };