complete-node-bootcamp
complete-node-bootcamp copied to clipboard
Add `role` to` User.create` method in signup function
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,
});
....
}
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.
thank u @LexieLiu19