refactor(api): import add-donation schema (#55876)

This commit is contained in:
Oliver Eyton-Williams
2024-08-19 13:30:02 +02:00
committed by GitHub
parent e0bda03fbb
commit 7345989917
3 changed files with 21 additions and 20 deletions
+2 -20
View File
@@ -1,7 +1,4 @@
import {
Type,
type FastifyPluginCallbackTypebox
} from '@fastify/type-provider-typebox';
import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
import Stripe from 'stripe';
import {
donationSubscriptionConfig,
@@ -62,22 +59,7 @@ export const donateRoutes: FastifyPluginCallbackTypebox = (
fastify.post(
'/donate/add-donation',
{
schema: {
body: Type.Object({}),
response: {
200: Type.Object({
isDonating: Type.Boolean()
}),
400: Type.Object({
message: Type.Literal('User is already donating.'),
type: Type.Literal('info')
}),
500: Type.Object({
message: Type.Literal('Something went wrong.'),
type: Type.Literal('danger')
})
}
}
schema: schemas.addDonation
},
async (req, reply) => {
try {
+1
View File
@@ -11,6 +11,7 @@ export { msTrophyChallengeCompleted } from './schemas/challenge/ms-trophy-challe
export { projectCompleted } from './schemas/challenge/project-completed';
export { saveChallenge } from './schemas/challenge/save-challenge';
export { deprecatedEndpoints } from './schemas/deprecated';
export { addDonation } from './schemas/donate/add-donation';
export { chargeStripeCard } from './schemas/donate/charge-stripe-card';
export { chargeStripe } from './schemas/donate/charge-stripe';
export { createStripePaymentIntent } from './schemas/donate/create-stripe-payment-intent';
+18
View File
@@ -0,0 +1,18 @@
import { Type } from '@fastify/type-provider-typebox';
export const addDonation = {
body: Type.Object({}),
response: {
200: Type.Object({
isDonating: Type.Boolean()
}),
400: Type.Object({
message: Type.Literal('User is already donating.'),
type: Type.Literal('info')
}),
500: Type.Object({
message: Type.Literal('Something went wrong.'),
type: Type.Literal('danger')
})
}
};