user.js 944 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. module.exports = {
  2. _id: { type: String, required: true, index: true, unique: true, min: 12, max: 12 },
  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. services: {
  11. password: {
  12. password: String,
  13. reset: {
  14. code: { type: String, min: 8, max: 8 },
  15. expires: { type: Date }
  16. },
  17. set: {
  18. code: { type: String, min: 8, max: 8 },
  19. expires: { type: Date }
  20. }
  21. },
  22. github: {
  23. id: Number,
  24. access_token: String
  25. }
  26. },
  27. ban: {
  28. banned: { type: Boolean, default: false, required: true },
  29. reason: String,
  30. bannedAt: Date,
  31. bannedUntil: Date
  32. },
  33. statistics: {
  34. songsRequested: { type: Number, default: 0, required: true }
  35. },
  36. liked: [{ type: String }],
  37. disliked: [{ type: String }],
  38. createdAt: { type: Date, default: Date.now() }
  39. };