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.

28 lines
755 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. description: { type: String },
  8. avatar: { type: String },
  9. mail: { type: String },
  10. phone: { type: String },
  11. telegram: { type: String },
  12. valorations: [{
  13. username: { type: String },
  14. value: { type: Number },
  15. comment: { type: String }
  16. }],
  17. favs: [{
  18. username: { type: String },
  19. userId: { type: String },
  20. avatar: { type: String }
  21. }]
  22. })
  23. userSchema.plugin(mongooseUniqueValidator);
  24. module.exports = mongoose.model('userModel', userSchema);