refactor(api): import add-donation schema (#55876)
parent
e0bda03fbb
commit
7345989917
|
@ -1,7 +1,4 @@
|
||||||
import {
|
import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
|
||||||
Type,
|
|
||||||
type FastifyPluginCallbackTypebox
|
|
||||||
} from '@fastify/type-provider-typebox';
|
|
||||||
import Stripe from 'stripe';
|
import Stripe from 'stripe';
|
||||||
import {
|
import {
|
||||||
donationSubscriptionConfig,
|
donationSubscriptionConfig,
|
||||||
|
@ -62,22 +59,7 @@ export const donateRoutes: FastifyPluginCallbackTypebox = (
|
||||||
fastify.post(
|
fastify.post(
|
||||||
'/donate/add-donation',
|
'/donate/add-donation',
|
||||||
{
|
{
|
||||||
schema: {
|
schema: schemas.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')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async (req, reply) => {
|
async (req, reply) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,6 +11,7 @@ export { msTrophyChallengeCompleted } from './schemas/challenge/ms-trophy-challe
|
||||||
export { projectCompleted } from './schemas/challenge/project-completed';
|
export { projectCompleted } from './schemas/challenge/project-completed';
|
||||||
export { saveChallenge } from './schemas/challenge/save-challenge';
|
export { saveChallenge } from './schemas/challenge/save-challenge';
|
||||||
export { deprecatedEndpoints } from './schemas/deprecated';
|
export { deprecatedEndpoints } from './schemas/deprecated';
|
||||||
|
export { addDonation } from './schemas/donate/add-donation';
|
||||||
export { chargeStripeCard } from './schemas/donate/charge-stripe-card';
|
export { chargeStripeCard } from './schemas/donate/charge-stripe-card';
|
||||||
export { chargeStripe } from './schemas/donate/charge-stripe';
|
export { chargeStripe } from './schemas/donate/charge-stripe';
|
||||||
export { createStripePaymentIntent } from './schemas/donate/create-stripe-payment-intent';
|
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