Skip to content

Commit

Permalink
feat(user): add bio ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBrisorgueil committed May 5, 2020
1 parent 3e3a2e4 commit aab5668
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/defaults/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ module.exports = {
},
whitelists: {
users: {
default: ['_id', 'id', 'firstName', 'lastName', 'displayName', 'email', 'roles', 'avatar', 'provider', 'updatedAt', 'createdAt', 'resetPasswordToken', 'resetPasswordExpires'],
update: ['firstName', 'lastName', 'email', 'avatar'],
updateAdmin: ['firstName', 'lastName', 'email', 'avatar', 'roles'],
default: ['_id', 'id', 'firstName', 'lastName', 'bio', 'email', 'avatar', 'roles', 'provider', 'updatedAt', 'createdAt', 'resetPasswordToken', 'resetPasswordExpires'],
update: ['firstName', 'lastName', 'bio', 'email', 'avatar'],
updateAdmin: ['firstName', 'lastName', 'bio', 'email', 'avatar', 'roles'],
recover: ['password', 'resetPasswordToken', 'resetPasswordExpires'],
roles: ['user', 'admin'],
},
Expand Down
1 change: 1 addition & 0 deletions modules/users/models/user.model.mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const UserMongoose = new Schema({
sub: String,
firstName: String,
lastName: String,
bio: String,
email: {
type: String,
unique: 'Email already exists',
Expand Down
4 changes: 4 additions & 0 deletions modules/users/models/user.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const UserSchema = Joi.object().keys({
lastName: Joi.string().alphanum().min(1).max(30)
.trim()
.required(),
bio: Joi.string().alphanum().min(1).max(200)
.trim()
.default('')
.optionnal(),
email: Joi.string().email({ minDomainAtoms: 2 }),
avatar: Joi.string().trim().default(''),
roles: Joi.array().items(Joi.string().valid(config.whitelists.users.roles)).min(1).default(['user']),
Expand Down

0 comments on commit aab5668

Please sign in to comment.