refactor(api): import add-donation schema (#55876)
parent
e0bda03fbb
commit
7345989917
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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')
|
||||
})
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue