diff --git a/routes/processes/nishauri_new.js b/routes/processes/nishauri_new.js index 48dda63..681d77a 100644 --- a/routes/processes/nishauri_new.js +++ b/routes/processes/nishauri_new.js @@ -4488,6 +4488,45 @@ router.post( } } ); +router.get( + "/get_chat_consent", + passport.authenticate("jwt", { session: false }), + async (req, res) => { + try { + const user_id = req.query.user_id; + + const user_consent = await NUsers.findOne({ + attributes: ['chatbot_consent', 'chatbot_consent_date'], + where: { + id: base64.decode(user_id) + } + }); + + if (user_consent) { + return res.status(200).json({ + success: true, + message: "User consent retrieved successfully", + data: { + user_consent, + user_id: user_id + } + }); + } else { + return res.status(404).json({ + success: false, + message: "User not found" + }); + } + } catch (error) { + console.error(error); + return res.status(500).json({ + success: false, + message: "Internal Server Error" + }); + } + } +); + module.exports = router; //module.exports = { router, users };