-
-
Save lubien/d543a56aaea120a3ff043aa6d6aa1ece to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
async signup(name, email, password) { | |
const exists = await models.user.findOne({ where: { email } }) | |
if (exists) { | |
throw new Error({ error: 'E-mail já existe. Tente se registrar com outro.' }) | |
} | |
const passwordEncrypted = await hashing(password) | |
const user = await models.user.build({ name, email, password: passwordEncrypted }) | |
await user.save() | |
return { user } | |
}, | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment