diff --git a/src/db/db.js b/src/db/db.js index 57ba5e9..d0915c3 100644 --- a/src/db/db.js +++ b/src/db/db.js @@ -37,7 +37,7 @@ const storeDB = (() => { })(); const store = new SequelizeStore({ - db: storeDB + db: storeDB, }); const Contact = sequelize.define("Contact", { @@ -51,7 +51,6 @@ const Contact = sequelize.define("Contact", { }, }); - const User = sequelize.define("User", { telegram: { type: DataTypes.INTEGER, diff --git a/src/routes/VerifyRoute.js b/src/routes/VerifyRoute.js index 7a984ba..4f39cfb 100644 --- a/src/routes/VerifyRoute.js +++ b/src/routes/VerifyRoute.js @@ -2,26 +2,26 @@ const { User } = require("../db/db"); const { addContact } = require("../db/utils"); function VerifyRoute(req, res) { - checkVerification(req.body.id, (success, msg, withUserID) => { - req.session.verified = success; - req.session.verifiedBy = withUserID; + checkVerification(req.body.id, (success, msg, withUserID) => { + req.session.verified = success; + req.session.verifiedBy = withUserID; - if (success) { - if (req.session.user) { - // If Logged In - addContact(req.session.user, withUserID, (success, msg) => { - res - .status(success ? 200 : 400) - .send({ success: success, message: msg, loggedIn: true }); - }); - } else { - // If Not Logged In - res.send({ success: success, message: msg, loggedIn: false }); - } + if (success) { + if (req.session.user) { + // If Logged In + addContact(req.session.user, withUserID, (success, msg) => { + res + .status(success ? 200 : 400) + .send({ success: success, message: msg, loggedIn: true }); + }); } else { - res.status(400).send({ success: success, message: msg }); + // If Not Logged In + res.send({ success: success, message: msg, loggedIn: false }); } - }); + } else { + res.status(400).send({ success: success, message: msg }); + } + }); } function checkVerification(id, done) {