fix(User.js, auth.service.js, localStrategy.js): change deprecated Joi.validate() to schema.validate() method (#322)

This commit is contained in:
Danny Avila 2023-05-18 17:39:06 -04:00 committed by GitHub
parent 92eee52c52
commit e56d90e45a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View file

@ -79,7 +79,7 @@ const userSchema = mongoose.Schema(
//Remove refreshToken from the response
userSchema.set('toJSON', {
transform: function (doc, ret, options) {
transform: function (_doc, ret,) {
delete ret.refreshToken;
return ret;
}
@ -168,7 +168,7 @@ module.exports.validateUser = (user) => {
password: Joi.string().min(8).max(60).allow('').allow(null)
};
return Joi.validate(user, schema);
return schema.validate(user);
};
const User = mongoose.model('User', userSchema);