diff --git a/migrations/20200213223053-create-user.js b/migrations/20200213223053-create-user.js index 7b6d2cb..edd758f 100644 --- a/migrations/20200213223053-create-user.js +++ b/migrations/20200213223053-create-user.js @@ -15,8 +15,7 @@ module.exports = { }, email: { type: Sequelize.STRING, - allowNull: false, - unique: true + allowNull: false }, avatar: { type: Sequelize.STRING diff --git a/routes/users.js b/routes/users.js index e4eda5b..286d6b8 100644 --- a/routes/users.js +++ b/routes/users.js @@ -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' }) }