e115934061
Publish `@librechat/data-schemas` to NPM / pack (push) Failing after 8s
Publish `@librechat/client` to NPM / pack (push) Failing after 0s
GitNexus Index / index (push) Failing after 1s
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been skipped
Sync Helm Chart Tags / Sync chart tags (push) Failing after 2s
Publish `librechat-data-provider` to NPM / pack (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Failing after 0s
Sync Helm Chart Tags / Ignore non-main push (push) Has been skipped
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Failing after 1s
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
GitNexus Index / post-index (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
const path = require('path');
|
|
const mongoose = require('mongoose');
|
|
const { User } = require('@librechat/data-schemas').createModels(mongoose);
|
|
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
|
|
const { askQuestion, silentExit } = require('./helpers');
|
|
const connect = require('./connect');
|
|
|
|
(async () => {
|
|
await connect();
|
|
|
|
console.purple('--------------------------');
|
|
console.purple('Reset terms acceptance');
|
|
console.purple('--------------------------');
|
|
|
|
console.yellow('This will reset the terms acceptance for all users.');
|
|
const confirm = await askQuestion('Are you sure you want to proceed? (y/n): ');
|
|
|
|
if (confirm.toLowerCase() !== 'y') {
|
|
console.yellow('Operation cancelled.');
|
|
silentExit(0);
|
|
}
|
|
|
|
try {
|
|
const result = await User.updateMany(
|
|
{},
|
|
{ $set: { termsAccepted: false, termsAcceptedAt: null } },
|
|
);
|
|
console.green(`Updated ${result.modifiedCount} user(s).`);
|
|
} catch (error) {
|
|
console.red('Error resetting terms acceptance:', error);
|
|
silentExit(1);
|
|
}
|
|
|
|
silentExit(0);
|
|
})();
|
|
|
|
process.on('uncaughtException', (err) => {
|
|
if (!err.message.includes('fetch failed')) {
|
|
console.error('There was an uncaught error:');
|
|
console.error(err);
|
|
}
|
|
|
|
if (err.message.includes('fetch failed')) {
|
|
return;
|
|
} else {
|
|
process.exit(1);
|
|
}
|
|
});
|