64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { Lang } from "@/constants/languages"
|
|
|
|
import { signUpSchema } from "@/components/Forms/Signup/schema"
|
|
|
|
// Query
|
|
export const staysInput = z
|
|
.object({
|
|
cursor: z
|
|
.number()
|
|
.optional()
|
|
.transform((num) => (num ? String(num) : undefined)),
|
|
limit: z.number().min(0).default(6),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
})
|
|
.default({})
|
|
|
|
export const friendTransactionsInput = z
|
|
.object({
|
|
limit: z.number().int().positive(),
|
|
page: z.number().int().positive(),
|
|
lang: z.nativeEnum(Lang).optional(),
|
|
})
|
|
.default({ limit: 5, page: 1 })
|
|
|
|
// Mutation
|
|
export const addCreditCardInput = z.object({
|
|
language: z.string(),
|
|
})
|
|
|
|
export const deleteCreditCardInput = z.object({
|
|
creditCardId: z.string(),
|
|
})
|
|
|
|
export const saveCreditCardInput = z.object({
|
|
transactionId: z.string(),
|
|
merchantId: z.string().optional(),
|
|
})
|
|
|
|
export const signupInput = signUpSchema
|
|
.extend({
|
|
language: z.nativeEnum(Lang),
|
|
})
|
|
.omit({ termsAccepted: true })
|
|
.transform((data) => ({
|
|
...data,
|
|
phoneNumber: data.phoneNumber.replace(/\s+/g, ""),
|
|
address: {
|
|
...data.address,
|
|
city: "",
|
|
country: "",
|
|
streetAddress: "",
|
|
},
|
|
}))
|
|
|
|
export const getSavedPaymentCardsInput = z.object({
|
|
supportedCards: z.array(z.string()),
|
|
})
|
|
|
|
export type GetSavedPaymentCardsInput = z.input<
|
|
typeof getSavedPaymentCardsInput
|
|
>
|