removed uniqueness of email, check unique of username on POST for user

This commit is contained in:
alex-phillips 2020-02-22 10:23:58 -05:00
parent 3e94c0826a
commit de0ede3885
2 changed files with 3 additions and 4 deletions

View File

@ -15,8 +15,7 @@ module.exports = {
},
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true
allowNull: false
},
avatar: {
type: Sequelize.STRING

View File

@ -62,14 +62,14 @@ router.post('/', async (req, res, next) => {
const existing = await User.findOne({
where: {
email: req.body.email
username: req.body.username
}
})
if (existing) {
return res.status(400).json({
status: 'error',
result: 'email_exists'
result: 'username_exists'
})
}