complete-node-bootcamp icon indicating copy to clipboard operation
complete-node-bootcamp copied to clipboard

Add `role` to` User.create` method in signup function

Open lexliu19 opened this issue 2 years ago • 2 comments

In Authorization: User Roles and Permissions chapter, we need to add role: req.body.role, to signup function, otherwise, the user role will always be default "user" and never updated to req.body.role

exports.signup = catchAsyncError(async (req, res, next) => {
  const newUser = await User.create({
    name: req.body.name,
    email: req.body.email,
    password: req.body.password,
    passwordConfirm: req.body.passwordConfirm,
    role: req.body.role,
  });
....
}

lexliu19 avatar Jul 14 '23 02:07 lexliu19

Hello < @LexieLiu19 , I wanted to request your permission to assign the open issue to me. Please let me know if it's okay to proceed with this assignment.

thakareniraj avatar Jul 31 '23 17:07 thakareniraj

thank u @LexieLiu19

Medo3-coder avatar Nov 23 '23 10:11 Medo3-coder