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.

29 lines
784 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. })
  24. userSchema.plugin(mongooseUniqueValidator);
  25. module.exports = mongoose.model('userModel', userSchema);