Skip to content

Commit

Permalink
get consented users for Nuru chat data personalization
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald-pro committed Jul 10, 2024
1 parent 76b4359 commit 772e2ca
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions routes/processes/nishauri_new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

0 comments on commit 772e2ca

Please sign in to comment.