MCPcopy
hub / github.com/freeCodeCamp/freeCodeCamp / createUserInput

Function createUserInput

api/src/utils/create-user.ts:61–106  ·  view source on GitHub ↗
(email: string)

Source from the content-addressed store, hash-verified

59 * @returns Default data for a new user.
60 */
61export function createUserInput(email: string) {
62 const username = 'fcc-' + crypto.randomUUID();
63 const externalId = crypto.randomUUID();
64 // This explicitly includes all array fields. This is not strictly necessary -
65 // Prisma will return an empty array even if the property is missing, but it's
66 // probably best to add them to the document, at least until we normalise the
67 // data.
68 return {
69 about: '',
70 acceptedPrivacyTerms: false,
71 donationEmails: [], // TODO(Post-MVP): Omit this from the document? (prisma will always return [])
72 email,
73 emailVerified: true, // this should be true until a user changes their email address
74 // TODO(Post-MVP): remove externalId?
75 externalId,
76 isBanned: false,
77 isCheater: false,
78 isDonating: false,
79 isHonest: false,
80 keyboardShortcuts: false,
81 location: '',
82 name: '',
83 unsubscribeId: nanoid(),
84 picture: '',
85 portfolio: [], // TODO(Post-MVP): Omit this from the document? (prisma will always return [])
86 profileUI: {
87 isLocked: false,
88 showAbout: false,
89 showCerts: false,
90 showDonation: false,
91 showExperience: false,
92 showHeatMap: false,
93 showLocation: false,
94 showName: false,
95 showPoints: false,
96 showPortfolio: false,
97 showTimeLine: false
98 },
99 sendQuincyEmail: null,
100 theme: 'default',
101 username,
102 usernameDisplay: username,
103 yearsTopContributor: [], // TODO: Omit this from the document? (prisma will always return []),
104 ...createResetProperties()
105 };
106}

Callers 11

resetDefaultUserFunction · 0.85
user.test.tsFile · 0.85
settings.test.tsFile · 0.85
user.test.tsFile · 0.85
donate.test.tsFile · 0.85
findOrCreateUserFunction · 0.85
classroom.test.tsFile · 0.85
auth0.test.tsFile · 0.85
extensions.test.tsFile · 0.85

Calls 1

createResetPropertiesFunction · 0.85

Tested by

no test coverage detected