mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
feat: add terms acceptance timestamp tracking and migration script
This commit is contained in:
parent
3e8ef24cfa
commit
44f7aad007
10 changed files with 134 additions and 4 deletions
|
|
@ -77,7 +77,10 @@ const getTermsStatusController = async (req, res) => {
|
|||
if (!user) {
|
||||
return res.status(404).json({ message: 'User not found' });
|
||||
}
|
||||
res.status(200).json({ termsAccepted: !!user.termsAccepted });
|
||||
res.status(200).json({
|
||||
termsAccepted: !!user.termsAccepted,
|
||||
termsAcceptedAt: user.termsAcceptedAt || null,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Error fetching terms acceptance status:', error);
|
||||
res.status(500).json({ message: 'Error fetching terms acceptance status' });
|
||||
|
|
@ -86,7 +89,14 @@ const getTermsStatusController = async (req, res) => {
|
|||
|
||||
const acceptTermsController = async (req, res) => {
|
||||
try {
|
||||
const user = await User.findByIdAndUpdate(req.user.id, { termsAccepted: true }, { new: true });
|
||||
const user = await User.findByIdAndUpdate(
|
||||
req.user.id,
|
||||
{
|
||||
termsAccepted: true,
|
||||
termsAcceptedAt: new Date(),
|
||||
},
|
||||
{ new: true },
|
||||
);
|
||||
if (!user) {
|
||||
return res.status(404).json({ message: 'User not found' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue