Update config/migrate-terms-timestamp.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Marco Beretta 2025-12-07 03:57:02 +01:00
parent 0ea483c598
commit e49dad8209
No known key found for this signature in database
GPG key ID: D918033D8E74CC11

View file

@ -62,6 +62,9 @@ const connect = require('./connect');
try {
// Use createdAt as fallback for termsAcceptedAt
const termsAcceptedAt = user.createdAt || new Date();
if (!user.createdAt) {
console.yellow(`Warning: User ${user._id} has no createdAt, using current date for termsAcceptedAt`);
}
await User.updateOne({ _id: user._id }, { $set: { termsAcceptedAt } });
migratedCount++;