You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
997 B

  1. var mongoose = require('mongoose'),
  2. Schema = mongoose.Schema;
  3. var mongooseUniqueValidator = require('mongoose-unique-validator');
  4. var userSchema = new Schema({
  5. username: { type: String, unique: true },
  6. password: { type: String },
  7. token: { type: String },
  8. description: { type: String },
  9. avatar: { type: String },
  10. mail: { type: String },
  11. phone: { type: String },
  12. telegram: { type: String },
  13. valorations: [{
  14. username: { type: String },
  15. value: { type: Number },
  16. comment: { type: String }
  17. }],
  18. favs: [{
  19. username: { type: String },
  20. userId: { type: String },
  21. avatar: { type: String }
  22. }],
  23. notifications: [{
  24. type: { type: String },//fav, comment, join
  25. otherusername: { type: String },
  26. description: { type: String },
  27. date: { type: Date },
  28. link: { type: String }
  29. }]
  30. })
  31. userSchema.plugin(mongooseUniqueValidator);
  32. module.exports = mongoose.model('userModel', userSchema);