From 794d996eac6ff8d5cd174bd73b6731806fe362e8 Mon Sep 17 00:00:00 2001 From: rohan09-raj Date: Fri, 26 Aug 2022 09:13:22 +0530 Subject: message modal and api fix --- server/controllers/message.js | 13 ++++++++++++- server/controllers/users.js | 5 ++++- server/routes/message.js | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/controllers/message.js b/server/controllers/message.js index 37de7d2..8061c7a 100644 --- a/server/controllers/message.js +++ b/server/controllers/message.js @@ -26,4 +26,15 @@ const sendMessage = async (req, res) => { } }; -export default {sendOTP, sendMessage}; +const sendMessages = async (req, res) => { + const {mobile, message} = req.body; + + try { + sendSMS(mobile, message); + res.status(200).json({message: 'Message sent successfully'}); + } catch (error) { + res.status(404).json({message: error}); + } +}; + +export default {sendOTP, sendMessage, sendMessages}; diff --git a/server/controllers/users.js b/server/controllers/users.js index 0d2088b..12d98a4 100644 --- a/server/controllers/users.js +++ b/server/controllers/users.js @@ -121,7 +121,10 @@ const deleteUser = async (req, res) => { const getUpdatingUsers = async (req, res) => { try { - const updatingUsers = await UserDetails.find({isUpdating: true}); + const updatingUsers = await UserDetails.find({ + isUpdating: true, + verified: true, + }); return res.status(200).json(updatingUsers); } catch (error) { res.status(404).json({message: error.message}); diff --git a/server/routes/message.js b/server/routes/message.js index 0062838..0ebb7db 100644 --- a/server/routes/message.js +++ b/server/routes/message.js @@ -5,5 +5,6 @@ const router = Express.Router(); router.post('/otp', message.sendOTP); router.post('/message', message.sendMessage); +router.post('/messages', message.sendMessages); export default router; -- cgit v1.2.3-73-gaa49b