feat: booking confirmation page with hardcoded data
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BedTypeEnum } from "@/constants/booking"
|
||||
|
||||
// MUTATION
|
||||
export const createBookingSchema = z
|
||||
.object({
|
||||
data: z.object({
|
||||
@@ -32,4 +35,46 @@ export const createBookingSchema = z
|
||||
paymentUrl: d.data.attributes.paymentUrl,
|
||||
}))
|
||||
|
||||
type CreateBookingData = z.infer<typeof createBookingSchema>
|
||||
// QUERY
|
||||
const childrenAgesSchema = z.object({
|
||||
age: z.number(),
|
||||
bedType: z.nativeEnum(BedTypeEnum),
|
||||
})
|
||||
|
||||
const guestSchema = z.object({
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
})
|
||||
|
||||
const packagesSchema = z.object({
|
||||
accessibility: z.boolean(),
|
||||
allergyFriendly: z.boolean(),
|
||||
breakfast: z.boolean(),
|
||||
petFriendly: z.boolean(),
|
||||
})
|
||||
|
||||
export const bookingConfirmationSchema = z
|
||||
.object({
|
||||
data: z.object({
|
||||
attributes: z.object({
|
||||
adults: z.number(),
|
||||
checkInDate: z.date({ coerce: true }),
|
||||
checkOutDate: z.date({ coerce: true }),
|
||||
createDateTime: z.date({ coerce: true }),
|
||||
childrenAges: z.array(childrenAgesSchema),
|
||||
computedReservationStatus: z.string(),
|
||||
confirmationNumber: z.string(),
|
||||
currencyCode: z.string(),
|
||||
guest: guestSchema,
|
||||
hasPayRouting: z.boolean(),
|
||||
hotelId: z.string(),
|
||||
packages: packagesSchema,
|
||||
rateCode: z.string(),
|
||||
reservationStatus: z.string(),
|
||||
totalPrice: z.number(),
|
||||
}),
|
||||
id: z.string(),
|
||||
type: z.literal("booking"),
|
||||
}),
|
||||
})
|
||||
.transform(({ data }) => data.attributes)
|
||||
|
||||
Reference in New Issue
Block a user