66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import type { ZodOpenApiPathsObject } from "zod-openapi";
|
|
import {
|
|
CreateReferralCodeResponseSchema,
|
|
RedeemReferralCodeResponseSchema,
|
|
} from "../../../referrals/apiReferralCode.js";
|
|
import {
|
|
CreateReferralCodeParamsSchema,
|
|
RedeemReferralCodeParamsSchema,
|
|
} from "../../../referrals/referralOpModels.js";
|
|
|
|
const ReferralCodeSchema = CreateReferralCodeResponseSchema.meta({
|
|
id: "ReferralCode",
|
|
description: "Referral code object returned by the API",
|
|
});
|
|
|
|
const RedeemReferralCodeResponseSchemaWithMeta =
|
|
RedeemReferralCodeResponseSchema.meta({
|
|
id: "RedeemReferralCodeResponse",
|
|
description: "Redemption response object returned by the API",
|
|
});
|
|
|
|
export const referralsOpenApi: ZodOpenApiPathsObject = {
|
|
"/referrals/code": {
|
|
post: {
|
|
summary: "Create a referral code",
|
|
tags: ["referrals"],
|
|
requestBody: {
|
|
content: {
|
|
"application/json": { schema: CreateReferralCodeParamsSchema },
|
|
},
|
|
},
|
|
responses: {
|
|
"200": {
|
|
description: "Referral code generated successfully",
|
|
content: {
|
|
"application/json": {
|
|
schema: ReferralCodeSchema,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"/referrals/redeem": {
|
|
post: {
|
|
summary: "Redeem a referral code",
|
|
tags: ["referrals"],
|
|
requestBody: {
|
|
content: {
|
|
"application/json": { schema: RedeemReferralCodeParamsSchema },
|
|
},
|
|
},
|
|
responses: {
|
|
"200": {
|
|
description: "Referral code redeemed successfully",
|
|
content: {
|
|
"application/json": {
|
|
schema: RedeemReferralCodeResponseSchemaWithMeta,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|