From c2bad3120ab0a545a1edf6b1f5cf5a109d0ba5d3 Mon Sep 17 00:00:00 2001 From: Ronald-pro <36841157+Ronald-pro@users.noreply.github.com> Date: Thu, 4 Jul 2024 09:03:41 +0300 Subject: [PATCH] tracking new nishauri app version --- models/n_users.js | 7 ++++--- routes/processes/nishauri_new.js | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/models/n_users.js b/models/n_users.js index d5df7ba..199a5c5 100644 --- a/models/n_users.js +++ b/models/n_users.js @@ -9,7 +9,7 @@ const NUsers = sequelize.sequelize.define( primaryKey: true, autoIncrement: true }, - + password:Sequelize.STRING, last_login:Sequelize.STRING, first_name:Sequelize.STRING, @@ -26,8 +26,9 @@ const NUsers = sequelize.sequelize.define( profile_otp_number:Sequelize.STRING, profile_otp_date:Sequelize.DATEONLY, profile_status: Sequelize.STRING, - refresh_token: Sequelize.STRING - + refresh_token: Sequelize.STRING, + app_version: Sequelize.STRING + }, { timestamps: true, paranoid: true, diff --git a/routes/processes/nishauri_new.js b/routes/processes/nishauri_new.js index 0bdcf3a..52d9fe8 100644 --- a/routes/processes/nishauri_new.js +++ b/routes/processes/nishauri_new.js @@ -74,6 +74,7 @@ router.post("/signup", async (req, res) => { let dob = req.body.dob; let gender = req.body.gender; let today = moment(new Date().toDateString()).format("YYYY-MM-DD"); + let app_version = req.body.app_version; // Check if Terms Are Accepted let boolVal; @@ -135,7 +136,7 @@ router.post("/signup", async (req, res) => { }); const log_login_attempt = await NUsers.update( - { refresh_token: refreshToken }, + { refresh_token: refreshToken, last_login: today, app_version: app_version }, { where: { id: new_user.id } } ); @@ -276,6 +277,7 @@ router.post("/revoke_token", async (req, res) => { router.post("/signin", async (req, res) => { let vusername = req.body.user_name; let password_1 = req.body.password; + let app_version = req.body.app_version; let today = moment(new Date().toDateString()).format("YYYY-MM-DD"); //Check If User Exists @@ -342,7 +344,7 @@ router.post("/signin", async (req, res) => { try { const log_login = await NUsers.update( - { last_login: today, refresh_token: refreshToken }, + { last_login: today, refresh_token: refreshToken, app_version: app_version }, { where: { id: check_username.id } } ); const token = jwt.sign(