feat(learn): add full stack certificate md and handle errors
Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
2cfc28915c
commit
89d5c891e3
@ -6,6 +6,7 @@ import { Observable } from 'rx';
|
|||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
import { isEmail } from 'validator';
|
import { isEmail } from 'validator';
|
||||||
import format from 'date-fns/format';
|
import format from 'date-fns/format';
|
||||||
|
import { reportError } from '../middlewares/sentry-error-handler.js';
|
||||||
|
|
||||||
import { ifNoUser401 } from '../utils/middleware';
|
import { ifNoUser401 } from '../utils/middleware';
|
||||||
import { observeQuery } from '../utils/rx';
|
import { observeQuery } from '../utils/rx';
|
||||||
@ -78,6 +79,12 @@ const successMessage = (username, name) => dedent`
|
|||||||
Congratulations on behalf of the freeCodeCamp.org team!
|
Congratulations on behalf of the freeCodeCamp.org team!
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const failureMessage = name => dedent`
|
||||||
|
Something went wrong with the verification of ${name}, please try again.
|
||||||
|
If you continue to receive this error, you can send a message to
|
||||||
|
support@freeCodeCamp.org to get help.
|
||||||
|
`;
|
||||||
|
|
||||||
function ifNoSuperBlock404(req, res, next) {
|
function ifNoSuperBlock404(req, res, next) {
|
||||||
const { superBlock } = req.body;
|
const { superBlock } = req.body;
|
||||||
if (superBlock && superBlocks.includes(superBlock)) {
|
if (superBlock && superBlocks.includes(superBlock)) {
|
||||||
@ -302,27 +309,29 @@ function createVerifyCert(certTypeIds, app) {
|
|||||||
[certType]: true
|
[certType]: true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (challenge) {
|
// certificate doesn't exist or
|
||||||
const { id, tests, challengeType } = challenge;
|
// connection error
|
||||||
if (
|
if (!challenge) {
|
||||||
!user[certType] &&
|
reportError(`Error claiming ${certName}`);
|
||||||
!isCertified(tests, user.completedChallenges)
|
return Observable.just(failureMessage(certName));
|
||||||
) {
|
|
||||||
return Observable.just(notCertifiedMessage(certName));
|
|
||||||
}
|
|
||||||
updateData = {
|
|
||||||
...updateData,
|
|
||||||
completedChallenges: [
|
|
||||||
...user.completedChallenges,
|
|
||||||
{
|
|
||||||
id,
|
|
||||||
completedDate: new Date(),
|
|
||||||
challengeType
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { id, tests, challengeType } = challenge;
|
||||||
|
if (!user[certType] && !isCertified(tests, user.completedChallenges)) {
|
||||||
|
return Observable.just(notCertifiedMessage(certName));
|
||||||
|
}
|
||||||
|
updateData = {
|
||||||
|
...updateData,
|
||||||
|
completedChallenges: [
|
||||||
|
...user.completedChallenges,
|
||||||
|
{
|
||||||
|
id,
|
||||||
|
completedDate: new Date(),
|
||||||
|
challengeType
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
if (!user.name) {
|
if (!user.name) {
|
||||||
return Observable.just(noNameMessage);
|
return Observable.just(noNameMessage);
|
||||||
}
|
}
|
||||||
|
@ -472,8 +472,7 @@ export class CertificationSettings extends Component {
|
|||||||
is2018DataVisCert,
|
is2018DataVisCert,
|
||||||
isApisMicroservicesCert,
|
isApisMicroservicesCert,
|
||||||
isFrontEndLibsCert,
|
isFrontEndLibsCert,
|
||||||
is2020QaCert,
|
isInfosecQaCert,
|
||||||
is2020InfosecCert,
|
|
||||||
isJsAlgoDataStructCert,
|
isJsAlgoDataStructCert,
|
||||||
isRespWebDesignCert
|
isRespWebDesignCert
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -482,8 +481,7 @@ export class CertificationSettings extends Component {
|
|||||||
is2018DataVisCert &&
|
is2018DataVisCert &&
|
||||||
isApisMicroservicesCert &&
|
isApisMicroservicesCert &&
|
||||||
isFrontEndLibsCert &&
|
isFrontEndLibsCert &&
|
||||||
is2020QaCert &&
|
isInfosecQaCert &&
|
||||||
is2020InfosecCert &&
|
|
||||||
isJsAlgoDataStructCert &&
|
isJsAlgoDataStructCert &&
|
||||||
isRespWebDesignCert;
|
isRespWebDesignCert;
|
||||||
|
|
||||||
@ -509,11 +507,11 @@ export class CertificationSettings extends Component {
|
|||||||
return (
|
return (
|
||||||
<FullWidthRow key={superBlock}>
|
<FullWidthRow key={superBlock}>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<h3>Full Stack Certification</h3>
|
<h3>Legacy Full Stack Certification</h3>
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
Once you've earned the following freeCodeCamp certifications, you'll
|
Once you've earned the following freeCodeCamp certifications, you'll
|
||||||
be able to claim The Full Stack Developer Certification:
|
be able to claim the Legacy Full Stack Developer Certification:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Responsive Web Design</li>
|
<li>Responsive Web Design</li>
|
||||||
@ -521,7 +519,7 @@ export class CertificationSettings extends Component {
|
|||||||
<li>Front End Libraries</li>
|
<li>Front End Libraries</li>
|
||||||
<li>Data Visualization</li>
|
<li>Data Visualization</li>
|
||||||
<li>APIs and Microservices</li>
|
<li>APIs and Microservices</li>
|
||||||
<li>Quality Assurance</li>
|
<li>Legacy Information Security and Quality Assurance</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
18
curriculum/challenges/_meta/full-stack-certificate/meta.json
Normal file
18
curriculum/challenges/_meta/full-stack-certificate/meta.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "Full Stack Certificate",
|
||||||
|
"dashedName": "full-stack-certificate",
|
||||||
|
"order": 5,
|
||||||
|
"time": "",
|
||||||
|
"template": "",
|
||||||
|
"required": [],
|
||||||
|
"superBlock": "certificates",
|
||||||
|
"superOrder": 12,
|
||||||
|
"challengeOrder": [
|
||||||
|
[
|
||||||
|
"561add10cb82ac38a17213bd",
|
||||||
|
"Full Stack Certificate"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"isPrivate": true,
|
||||||
|
"fileName": "12-certificates/full-stack-certificate.json"
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
id: 561add10cb82ac38a17213bd
|
||||||
|
title: Full Stack Certificate
|
||||||
|
challengeType: 7
|
||||||
|
isHidden: false
|
||||||
|
isPrivate: true
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
<section id='description'>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
<section id='instructions'>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
<section id='tests'>
|
||||||
|
|
||||||
|
```yml
|
||||||
|
tests:
|
||||||
|
- id: 561add10cb82ac38a17513bc
|
||||||
|
title: Responsive Web Design Certificate
|
||||||
|
- id: 561abd10cb81ac38a17513bc
|
||||||
|
title: JavaScript Algorithms and Data Structures Certificate
|
||||||
|
- id: 561acd10cb82ac38a17513bc
|
||||||
|
title: Front End Libraries Certificate
|
||||||
|
- id: 5a553ca864b52e1d8bceea14
|
||||||
|
title: Data Visualization Certificate
|
||||||
|
- id: 561add10cb82ac38a17523bc
|
||||||
|
title: API's and Microservices Certificate
|
||||||
|
- id: 561add10cb82ac38a17213bc
|
||||||
|
title: Legacy Information Security and Quality Assurance Certificate
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
## Challenge Seed
|
||||||
|
<section id='challengeSeed'>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
<section id='solution'>
|
||||||
|
|
||||||
|
```js
|
||||||
|
// solution required
|
||||||
|
```
|
||||||
|
|
||||||
|
</section>
|
Reference in New Issue
Block a user