mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: add a2-english cert and exam (#62855)
This commit is contained in:
@@ -105,6 +105,7 @@ model user {
|
||||
emailVerifyTTL DateTime? // Null | Undefined
|
||||
externalId String
|
||||
githubProfile String? // Undefined
|
||||
isA2EnglishCert Boolean? // Undefined
|
||||
isApisMicroservicesCert Boolean? // Undefined
|
||||
isBackEndCert Boolean? // Undefined
|
||||
isBanned Boolean? // Undefined
|
||||
|
||||
@@ -28,6 +28,7 @@ export const newUser = (email: string) => ({
|
||||
id: expect.stringMatching(mongodbIdRe),
|
||||
is2018DataVisCert: false,
|
||||
is2018FullStackCert: false,
|
||||
isA2EnglishCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isBackEndCert: false,
|
||||
isBanned: false,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { pick, omit } from 'lodash-es';
|
||||
const nullableFlags = [
|
||||
'is2018DataVisCert',
|
||||
'is2018FullStackCert',
|
||||
'isA2EnglishCert',
|
||||
'isApisMicroservicesCert',
|
||||
'isBackEndCert',
|
||||
'isCheater',
|
||||
|
||||
@@ -292,6 +292,7 @@ describe('certificate routes', () => {
|
||||
}
|
||||
},
|
||||
isCertMap: {
|
||||
isA2EnglishCert: false,
|
||||
isRespWebDesignCert: true,
|
||||
isRespWebDesignCertV9: false,
|
||||
isJavascriptCertV9: false,
|
||||
|
||||
@@ -21,6 +21,7 @@ import { SHOW_UPCOMING_CHANGES } from '../../utils/env.js';
|
||||
import { isKnownCertSlug } from '../helpers/certificate-utils.js';
|
||||
|
||||
const {
|
||||
a2EnglishId,
|
||||
legacyFrontEndChallengeId,
|
||||
legacyBackEndChallengeId,
|
||||
legacyDataVisId,
|
||||
@@ -160,13 +161,15 @@ function createCertTypeIds(challenges: ReturnType<typeof getChallenges>) {
|
||||
challenges
|
||||
),
|
||||
[certTypes.javascriptV9]: getCertById(javascriptV9Id, challenges),
|
||||
[certTypes.respWebDesignV9]: getCertById(respWebDesignV9Id, challenges)
|
||||
[certTypes.respWebDesignV9]: getCertById(respWebDesignV9Id, challenges),
|
||||
|
||||
// upcoming
|
||||
[certTypes.a2English]: getCertById(a2EnglishId, challenges)
|
||||
};
|
||||
}
|
||||
|
||||
interface CertI {
|
||||
isA2EnglishCert?: boolean;
|
||||
isRespWebDesignCert?: boolean;
|
||||
isJsAlgoDataStructCert?: boolean;
|
||||
isJsAlgoDataStructCertV8?: boolean;
|
||||
@@ -192,6 +195,7 @@ interface CertI {
|
||||
|
||||
function getUserIsCertMap(user: CertI) {
|
||||
const {
|
||||
isA2EnglishCert = false,
|
||||
isRespWebDesignCert = false,
|
||||
isJsAlgoDataStructCert = false,
|
||||
isJsAlgoDataStructCertV8 = false,
|
||||
@@ -216,6 +220,7 @@ function getUserIsCertMap(user: CertI) {
|
||||
} = user;
|
||||
|
||||
return {
|
||||
isA2EnglishCert,
|
||||
isRespWebDesignCert,
|
||||
isJsAlgoDataStructCert,
|
||||
isJsAlgoDataStructCertV8,
|
||||
@@ -383,6 +388,7 @@ export const protectedCertificateRoutes: FastifyPluginCallbackTypebox = (
|
||||
completedChallenges: true,
|
||||
is2018DataVisCert: true,
|
||||
is2018FullStackCert: true,
|
||||
isA2EnglishCert: true,
|
||||
isApisMicroservicesCert: true,
|
||||
isBackEndCert: true,
|
||||
isDataVisCert: true,
|
||||
|
||||
@@ -274,6 +274,7 @@ const publicUserData = {
|
||||
githubProfile: testUserData.githubProfile,
|
||||
is2018DataVisCert: testUserData.is2018DataVisCert,
|
||||
is2018FullStackCert: testUserData.is2018FullStackCert, // TODO: should this be returned? The client doesn't use it at the moment.
|
||||
isA2EnglishCert: testUserData.isA2EnglishCert,
|
||||
isApisMicroservicesCert: testUserData.isApisMicroservicesCert,
|
||||
isBackEndCert: testUserData.isBackEndCert,
|
||||
isCheater: testUserData.isCheater,
|
||||
@@ -326,6 +327,7 @@ const sessionUserData = {
|
||||
|
||||
const baseProgressData = {
|
||||
currentChallengeId: '',
|
||||
isA2EnglishCert: false,
|
||||
isRespWebDesignCert: false,
|
||||
is2018DataVisCert: false,
|
||||
isFrontEndLibsCert: false,
|
||||
@@ -998,6 +1000,7 @@ describe('userRoutes', () => {
|
||||
yearsTopContributor: [],
|
||||
is2018DataVisCert: false,
|
||||
is2018FullStackCert: false,
|
||||
isA2EnglishCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isBackEndCert: false,
|
||||
isCheater: false,
|
||||
|
||||
@@ -667,6 +667,7 @@ export const userGetRoutes: FastifyPluginCallbackTypebox = (
|
||||
id: true,
|
||||
is2018DataVisCert: true,
|
||||
is2018FullStackCert: true,
|
||||
isA2EnglishCert: true,
|
||||
isApisMicroservicesCert: true,
|
||||
isBackEndCert: true,
|
||||
isCheater: true,
|
||||
|
||||
@@ -60,6 +60,7 @@ export const unprotectedCertificateRoutes: FastifyPluginCallbackTypebox = (
|
||||
select: {
|
||||
isBanned: true,
|
||||
isCheater: true,
|
||||
isA2EnglishCert: true,
|
||||
isFrontEndCert: true,
|
||||
isBackEndCert: true,
|
||||
isFullStackCert: true,
|
||||
|
||||
@@ -187,6 +187,7 @@ const publicUserData = {
|
||||
githubProfile: testUserData.githubProfile,
|
||||
is2018DataVisCert: testUserData.is2018DataVisCert,
|
||||
is2018FullStackCert: testUserData.is2018FullStackCert, // TODO: should this be returned? The client doesn't use it at the moment.
|
||||
isA2EnglishCert: testUserData.isA2EnglishCert,
|
||||
isApisMicroservicesCert: testUserData.isApisMicroservicesCert,
|
||||
isBackEndCert: testUserData.isBackEndCert,
|
||||
isCheater: testUserData.isCheater,
|
||||
|
||||
@@ -6,6 +6,7 @@ export const genericError = Type.Object({
|
||||
});
|
||||
|
||||
export const isCertMap = Type.Object({
|
||||
isA2EnglishCert: Type.Boolean(),
|
||||
isRespWebDesignCert: Type.Boolean(),
|
||||
isRespWebDesignCertV9: Type.Boolean(),
|
||||
isJavascriptCertV9: Type.Boolean(),
|
||||
|
||||
@@ -68,6 +68,7 @@ export const getSessionUser = {
|
||||
id: Type.String(),
|
||||
is2018DataVisCert: Type.Boolean(),
|
||||
is2018FullStackCert: Type.Boolean(),
|
||||
isA2EnglishCert: Type.Boolean(),
|
||||
isApisMicroservicesCert: Type.Boolean(),
|
||||
isBackEndCert: Type.Boolean(),
|
||||
isCheater: Type.Boolean(),
|
||||
|
||||
@@ -52,6 +52,7 @@ export const getPublicProfile = {
|
||||
githubProfile: Type.Optional(Type.String()),
|
||||
is2018DataVisCert: Type.Boolean(),
|
||||
is2018FullStackCert: Type.Boolean(),
|
||||
isA2EnglishCert: Type.Boolean(),
|
||||
isApisMicroservicesCert: Type.Boolean(),
|
||||
isBackEndCert: Type.Boolean(),
|
||||
isCheater: Type.Boolean(),
|
||||
|
||||
@@ -16,6 +16,7 @@ export const createResetProperties = () => ({
|
||||
currentChallengeId: '',
|
||||
is2018DataVisCert: false,
|
||||
is2018FullStackCert: false,
|
||||
isA2EnglishCert: false,
|
||||
isApisMicroservicesCert: false,
|
||||
isBackEndCert: false,
|
||||
isCollegeAlgebraPyCertV8: false,
|
||||
|
||||
Reference in New Issue
Block a user