user.js 815 B

123456789101112131415161718192021222324252627282930313233
  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. statistics: {
  28. songsRequested: { type: Number, default: 0, required: true }
  29. },
  30. liked: [{ type: String }],
  31. disliked: [{ type: String }],
  32. createdAt: { type: Date, default: Date.now() }
  33. };