mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
chore: allow all seeded users to be modified (#54485)
This commit is contained in:
committed by
GitHub
parent
28d60b5262
commit
ec11a4be94
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ const path = require('path');
|
||||
const debug = require('debug');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') });
|
||||
const { MongoClient, ObjectId } = require('mongodb');
|
||||
const fullyCertifiedUser = require('./certified-user-data');
|
||||
const { demoUser, blankUser, fullyCertifiedUser } = require('./user-data');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
@@ -22,12 +22,6 @@ args.forEach(arg => {
|
||||
);
|
||||
});
|
||||
|
||||
if (args.includes('certified-user') && args.length > 1) {
|
||||
throw new Error(
|
||||
`Invalid arguments. When using 'certified-user', no other arguments are allowed.`
|
||||
);
|
||||
}
|
||||
|
||||
const log = debug('fcc:tools:seedLocalAuthUser');
|
||||
const { MONGOHQ_URL } = process.env;
|
||||
|
||||
@@ -85,135 +79,20 @@ const trophyChallenges = [
|
||||
}
|
||||
];
|
||||
|
||||
const demoUser = {
|
||||
_id: new ObjectId('5bd30e0f1caf6ac3ddddddb5'),
|
||||
email: 'foo@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
isBanned: false,
|
||||
isCheater: false,
|
||||
username: 'developmentuser',
|
||||
about: '',
|
||||
name: 'Development User',
|
||||
location: '',
|
||||
picture: '',
|
||||
acceptedPrivacyTerms: args.includes('--unset-privacy-terms') ? null : true,
|
||||
sendQuincyEmail: false,
|
||||
currentChallengeId: '',
|
||||
isHonest: false,
|
||||
isFrontEndCert: false,
|
||||
isDataVisCert: false,
|
||||
isBackEndCert: false,
|
||||
isFullStackCert: false,
|
||||
isRespWebDesignCert: false,
|
||||
is2018DataVisCert: false,
|
||||
isFrontEndLibsCert: false,
|
||||
isJsAlgoDataStructCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isInfosecQaCert: false,
|
||||
isQaCertV7: false,
|
||||
isInfosecCertV7: false,
|
||||
is2018FullStackCert: false,
|
||||
isSciCompPyCertV7: false,
|
||||
isDataAnalysisPyCertV7: false,
|
||||
isMachineLearningPyCertV7: false,
|
||||
isRelationalDatabaseCertV8: false,
|
||||
isCollegeAlgebraPyCertV8: false,
|
||||
isFoundationalCSharpCertV8: false,
|
||||
isJsAlgoDataStructCertV8: false,
|
||||
completedChallenges: args.includes('--seed-trophy-challenges')
|
||||
? trophyChallenges
|
||||
: [],
|
||||
portfolio: [],
|
||||
yearsTopContributor: args.includes('--top-contributor')
|
||||
? ['2017', '2018', '2019']
|
||||
: [],
|
||||
rand: 0.6126749173148205,
|
||||
theme: 'default',
|
||||
profileUI: {
|
||||
isLocked: true,
|
||||
showAbout: false,
|
||||
showCerts: false,
|
||||
showDonation: false,
|
||||
showHeatMap: false,
|
||||
showLocation: false,
|
||||
showName: false,
|
||||
showPoints: false,
|
||||
showPortfolio: false,
|
||||
showTimeLine: false
|
||||
},
|
||||
badges: {
|
||||
coreTeam: []
|
||||
},
|
||||
isDonating: args.includes('--donor'),
|
||||
emailAuthLinkTTL: null,
|
||||
emailVerifyTTL: null,
|
||||
keyboardShortcuts: true,
|
||||
externalId: '',
|
||||
unsubscribeId: 'ecJxUi7OM49f24hTpauP8'
|
||||
};
|
||||
|
||||
const blankUser = {
|
||||
_id: new ObjectId('5bd30e0f1caf6ac3ddddddb9'),
|
||||
email: 'bar@bar.com',
|
||||
emailVerified: true,
|
||||
progressTimestamps: [],
|
||||
isBanned: false,
|
||||
isCheater: false,
|
||||
username: 'twaha',
|
||||
about: '',
|
||||
name: 'Development User',
|
||||
location: '',
|
||||
picture: '',
|
||||
acceptedPrivacyTerms: true,
|
||||
sendQuincyEmail: false,
|
||||
currentChallengeId: '',
|
||||
isHonest: false,
|
||||
isFrontEndCert: false,
|
||||
isDataVisCert: false,
|
||||
isBackEndCert: false,
|
||||
isFullStackCert: false,
|
||||
isRespWebDesignCert: false,
|
||||
is2018DataVisCert: false,
|
||||
isFrontEndLibsCert: false,
|
||||
isJsAlgoDataStructCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isInfosecQaCert: false,
|
||||
isQaCertV7: false,
|
||||
isInfosecCertV7: false,
|
||||
is2018FullStackCert: false,
|
||||
isSciCompPyCertV7: false,
|
||||
isDataAnalysisPyCertV7: false,
|
||||
isMachineLearningPyCertV7: false,
|
||||
isRelationalDatabaseCertV8: false,
|
||||
isCollegeAlgebraPyCertV8: false,
|
||||
isFoundationalCSharpCertV8: false,
|
||||
completedChallenges: [],
|
||||
portfolio: [],
|
||||
yearsTopContributor: [],
|
||||
rand: 0.6126749173148205,
|
||||
theme: 'default',
|
||||
profileUI: {
|
||||
isLocked: true,
|
||||
showAbout: false,
|
||||
showCerts: false,
|
||||
showDonation: false,
|
||||
showHeatMap: false,
|
||||
showLocation: false,
|
||||
showName: false,
|
||||
showPoints: false,
|
||||
showPortfolio: false,
|
||||
showTimeLine: false
|
||||
},
|
||||
badges: {
|
||||
coreTeam: []
|
||||
},
|
||||
isDonating: false,
|
||||
emailAuthLinkTTL: null,
|
||||
emailVerifyTTL: null,
|
||||
externalId: '',
|
||||
unsubscribeId: 'ecJxUi7OM49f24hTpauP8'
|
||||
};
|
||||
[demoUser, blankUser, fullyCertifiedUser].forEach(user => {
|
||||
if (args.includes('--donor')) {
|
||||
user.isDonating = true;
|
||||
}
|
||||
if (args.includes('--top-contributor')) {
|
||||
user.yearsTopContributor = ['2017', '2018', '2019'];
|
||||
}
|
||||
if (args.includes('--unset-privacy-terms')) {
|
||||
user.acceptedPrivacyTerms = null;
|
||||
}
|
||||
if (args.includes('--seed-trophy-challenges')) {
|
||||
user.completedChallenges = trophyChallenges;
|
||||
}
|
||||
});
|
||||
|
||||
const client = new MongoClient(MONGOHQ_URL, { useNewUrlParser: true });
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user