From 05acc52e7d68bf94f92c559ddaae27d9be23a306 Mon Sep 17 00:00:00 2001 From: onkar-josh Date: Wed, 17 Jun 2020 15:08:37 +0530 Subject: [PATCH 1/3] added findone method to badges controller instead of findall method --- node-backend/controllers/v1/badgesController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-backend/controllers/v1/badgesController.js b/node-backend/controllers/v1/badgesController.js index c849b6a0b..66d5a0f77 100644 --- a/node-backend/controllers/v1/badgesController.js +++ b/node-backend/controllers/v1/badgesController.js @@ -116,7 +116,7 @@ module.exports.findOne = async (req, res) => { idSchema .validate({ id, org_id }, { abortEarly: false }) .then(() => { - Badges.findAll({ where: { org_id: org_id, id: id } }) + Badges.findOne({ where: { org_id: org_id, id: id } }) .then((data) => { if (data.length != 0) { res.status(200).send({ From 0b8e051fee0e65208e5a6cc937ea551db742359a Mon Sep 17 00:00:00 2001 From: onkar-josh Date: Wed, 17 Jun 2020 17:37:50 +0530 Subject: [PATCH 2/3] added updated findone query of core value controller --- node-backend/controllers/v1/CoreValueController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-backend/controllers/v1/CoreValueController.js b/node-backend/controllers/v1/CoreValueController.js index 1118ec019..7c34e65ea 100644 --- a/node-backend/controllers/v1/CoreValueController.js +++ b/node-backend/controllers/v1/CoreValueController.js @@ -119,7 +119,7 @@ module.exports.findOne = async (req, res) => { idSchema .validate({ id, org_id }, { abortEarly: false }) .then(() => { - CoreValue.findAll({ where: { org_id: org_id, id: id } }) + CoreValue.findOne({ where: { org_id: org_id, id: id } }) .then((data) => { if (data.length != 0) { res.status(200).send({ @@ -257,7 +257,7 @@ module.exports.getCoreValueById = async (req, res) => { idSchema .validate({ id }, { abortEarly: false }) .then(() => { - CoreValue.findAll({ + CoreValue.findOne({ where: { id: id }, attributes: [ "id", From 568262879919d6a46d9051e29feb40fff8d553c8 Mon Sep 17 00:00:00 2001 From: onkar-josh Date: Wed, 17 Jun 2020 17:39:12 +0530 Subject: [PATCH 3/3] updated users controller by changing findone query --- node-backend/controllers/v1/usersController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-backend/controllers/v1/usersController.js b/node-backend/controllers/v1/usersController.js index 497439edf..cb5c8d6ec 100644 --- a/node-backend/controllers/v1/usersController.js +++ b/node-backend/controllers/v1/usersController.js @@ -148,7 +148,7 @@ module.exports.getProfileById = async (req, res) => { idSchema .validate({ id }, { abortEarly: false }) .then(() => { - Users.findAll({ + Users.findOne({ where: { id: id }, attributes: { exclude: ["soft_delete", "soft_delete_by", "soft_delete_at"],