Browse Source

linting

cleanup/break-apart-app-js
Nareshkumar Rao 3 years ago
parent
commit
1a4d505933
  1. 3
      src/db/db.js
  2. 34
      src/routes/VerifyRoute.js

3
src/db/db.js

@ -37,7 +37,7 @@ const storeDB = (() => {
})(); })();
const store = new SequelizeStore({ const store = new SequelizeStore({
db: storeDB
db: storeDB,
}); });
const Contact = sequelize.define("Contact", { const Contact = sequelize.define("Contact", {
@ -51,7 +51,6 @@ const Contact = sequelize.define("Contact", {
}, },
}); });
const User = sequelize.define("User", { const User = sequelize.define("User", {
telegram: { telegram: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,

34
src/routes/VerifyRoute.js

@ -2,26 +2,26 @@ const { User } = require("../db/db");
const { addContact } = require("../db/utils"); const { addContact } = require("../db/utils");
function VerifyRoute(req, res) { 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 { } 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) { function checkVerification(id, done) {

Loading…
Cancel
Save