User.js 545 B

1234567891011121314
  1. const {model, Schema} = require('mongoose');
  2. const User = new Schema({
  3. userName: {type: String, unique: true, required: true},
  4. hashPassword: {type: String, required: true},
  5. isAdmin: {type: Boolean, default: false},
  6. isBanned: {type: Boolean, default: false},
  7. isMutted: {type: Boolean, default: false},
  8. avatar: {type: String, unique: true, required: false},
  9. messages: [{type: Schema.Types.ObjectId, ref: 'Message' }],
  10. friends: [{ type: Schema.Types.ObjectId, ref: 'User' }]
  11. })
  12. module.exports = model('User', User)