Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.createUser = async (req, res, next) => {
- try {
- var newUser = new User(req.body);
- // O cadastro de um morador sempre começa como falso, enquanto outros tipos são cadastrados aprovados
- newUser.approvedRegister = (newUser.userType == USER_TYPE_ENUM.RESIDENT ? false : true);
- await bcrypt.hash(newUser.password, saltRounds, async (error, hash) => {
- newUser.password = hash;
- newUser = await repository.createUser(newUser);
- res.status(HttpStatusCode.OK).send(newUser);
- });
- } catch (error) {
- res.status(HttpStatusCode.BAD_REQUEST).send({
- error
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement