summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorrohan09-raj <rajrohan1914@gmail.com>2022-08-26 09:13:22 +0530
committerrohan09-raj <rajrohan1914@gmail.com>2022-08-26 09:14:13 +0530
commit794d996eac6ff8d5cd174bd73b6731806fe362e8 (patch)
treedb4fdac631ae9dbe44c3ac79fe54c9335fc28f91 /server
parent2fae816ce7e95a3a99c8442debc49285898328d8 (diff)
message modal and api fix
Diffstat (limited to 'server')
-rw-r--r--server/controllers/message.js13
-rw-r--r--server/controllers/users.js5
-rw-r--r--server/routes/message.js1
3 files changed, 17 insertions, 2 deletions
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;