Skip to content

Commit 5d2598e

Browse files
Merge pull request #707 from freeCodeCamp/main
Create a new pull request by comparing changes across two branches
2 parents 36d4467 + 70be2fa commit 5d2598e

File tree

138 files changed

+9887
-3923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+9887
-3923
lines changed

api/src/routes/certificate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export const protectedCertificateRoutes: FastifyPluginCallbackTypebox = (
233233
await fastify.sendEmail(notifyUser);
234234
} catch (e) {
235235
fastify.log.error(e);
236-
// TODO: Log to Sentry
236+
fastify.Sentry.captureException(e);
237237
}
238238
}
239239

api/src/routes/donate.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
Type,
3-
type FastifyPluginCallbackTypebox
4-
} from '@fastify/type-provider-typebox';
1+
import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
52
import Stripe from 'stripe';
63
import {
74
donationSubscriptionConfig,
@@ -62,22 +59,7 @@ export const donateRoutes: FastifyPluginCallbackTypebox = (
6259
fastify.post(
6360
'/donate/add-donation',
6461
{
65-
schema: {
66-
body: Type.Object({}),
67-
response: {
68-
200: Type.Object({
69-
isDonating: Type.Boolean()
70-
}),
71-
400: Type.Object({
72-
message: Type.Literal('User is already donating.'),
73-
type: Type.Literal('info')
74-
}),
75-
500: Type.Object({
76-
message: Type.Literal('Something went wrong.'),
77-
type: Type.Literal('danger')
78-
})
79-
}
80-
}
62+
schema: schemas.addDonation
8163
},
8264
async (req, reply) => {
8365
try {
@@ -105,6 +87,7 @@ export const donateRoutes: FastifyPluginCallbackTypebox = (
10587
} as const;
10688
} catch (error) {
10789
fastify.log.error(error);
90+
fastify.Sentry.captureException(error);
10891
void reply.code(500);
10992
return {
11093
type: 'danger',
@@ -231,6 +214,7 @@ export const donateRoutes: FastifyPluginCallbackTypebox = (
231214
});
232215
} catch (error) {
233216
fastify.log.error(error);
217+
fastify.Sentry.captureException(error);
234218
void reply.code(500);
235219
return reply.send({
236220
error: 'Donation failed due to a server error.'

api/src/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export { msTrophyChallengeCompleted } from './schemas/challenge/ms-trophy-challe
1111
export { projectCompleted } from './schemas/challenge/project-completed';
1212
export { saveChallenge } from './schemas/challenge/save-challenge';
1313
export { deprecatedEndpoints } from './schemas/deprecated';
14+
export { addDonation } from './schemas/donate/add-donation';
1415
export { chargeStripeCard } from './schemas/donate/charge-stripe-card';
1516
export { chargeStripe } from './schemas/donate/charge-stripe';
1617
export { createStripePaymentIntent } from './schemas/donate/create-stripe-payment-intent';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Type } from '@fastify/type-provider-typebox';
2+
3+
export const addDonation = {
4+
body: Type.Object({}),
5+
response: {
6+
200: Type.Object({
7+
isDonating: Type.Boolean()
8+
}),
9+
400: Type.Object({
10+
message: Type.Literal('User is already donating.'),
11+
type: Type.Literal('info')
12+
}),
13+
500: Type.Object({
14+
message: Type.Literal('Something went wrong.'),
15+
type: Type.Literal('danger')
16+
})
17+
}
18+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"aa-test": {
3+
"defaultValue": false
4+
},
5+
"aa-test-in-component": {
6+
"defaultValue": false
7+
},
8+
"landing-page-redesign": {
9+
"defaultValue": false,
10+
"rules": [
11+
{
12+
"coverage": 1,
13+
"hashAttribute": "id",
14+
"seed": "landing-page-redesign",
15+
"hashVersion": 2,
16+
"variations": [false, true],
17+
"weights": [0.5, 0.5],
18+
"key": "landing-page-redesign",
19+
"meta": [
20+
{
21+
"key": "0",
22+
"name": "Control"
23+
},
24+
{
25+
"key": "1",
26+
"name": "Variation 1"
27+
}
28+
],
29+
"phase": "0",
30+
"name": "tests the conversion rate of the new design comparing to the old one"
31+
}
32+
]
33+
}
34+
}
35+

0 commit comments

Comments
 (0)