mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
feat: refactor acceptTermsController to use updateUser function for terms acceptance
This commit is contained in:
parent
44f7aad007
commit
314c170ec3
1 changed files with 4 additions and 8 deletions
|
|
@ -89,14 +89,10 @@ const getTermsStatusController = async (req, res) => {
|
||||||
|
|
||||||
const acceptTermsController = async (req, res) => {
|
const acceptTermsController = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const user = await User.findByIdAndUpdate(
|
const user = await updateUser(req.user.id, {
|
||||||
req.user.id,
|
termsAccepted: true,
|
||||||
{
|
termsAcceptedAt: new Date(),
|
||||||
termsAccepted: true,
|
});
|
||||||
termsAcceptedAt: new Date(),
|
|
||||||
},
|
|
||||||
{ new: true },
|
|
||||||
);
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return res.status(404).json({ message: 'User not found' });
|
return res.status(404).json({ message: 'User not found' });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue