Browse Source

lil rearrange

cleanup/break-apart-app-js
Nareshkumar Rao 3 years ago
parent
commit
413e9cacf7
  1. 7
      src/db/db.js

7
src/db/db.js

@ -40,7 +40,6 @@ const store = new SequelizeStore({
db: storeDB, db: storeDB,
expiration: process.env.COOKIE_EXPIRY_DURATION, expiration: process.env.COOKIE_EXPIRY_DURATION,
}); });
store.sync();
const Contact = sequelize.define("Contact", { const Contact = sequelize.define("Contact", {
user: { user: {
@ -52,7 +51,7 @@ const Contact = sequelize.define("Contact", {
allowNull: false, allowNull: false,
}, },
}); });
Contact.sync();
const User = sequelize.define("User", { const User = sequelize.define("User", {
telegram: { telegram: {
@ -65,6 +64,8 @@ const User = sequelize.define("User", {
}, },
}); });
Contact.sync();
User.sync().then(() => { User.sync().then(() => {
if (process.env.ADMIN_USERNAME && process.env.ADMIN_PASSWORD) { if (process.env.ADMIN_USERNAME && process.env.ADMIN_PASSWORD) {
User.create({ User.create({
@ -75,6 +76,8 @@ User.sync().then(() => {
} }
}); });
store.sync();
exports.User = User; exports.User = User;
exports.Contact = Contact; exports.Contact = Contact;
exports.sequelize = sequelize; exports.sequelize = sequelize;

Loading…
Cancel
Save