Merged in fix/dates-create-booking-output (pull request #1589)
fix: fixed bug with wrong schema * fix: fixed bug with wrong schema Approved-by: Niclas Edenvin
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
removePackageInput,
|
||||
updateBookingInput,
|
||||
} from "./input"
|
||||
import { createBookingSchema } from "./output"
|
||||
import { bookingConfirmationSchema, createBookingSchema } from "./output"
|
||||
|
||||
import type { Session } from "next-auth"
|
||||
|
||||
@@ -523,7 +523,7 @@ export const bookingMutationRouter = router({
|
||||
const apiJson = await apiResponse.json()
|
||||
|
||||
console.log("apiJson", apiJson)
|
||||
const verifiedData = createBookingSchema.safeParse(apiJson)
|
||||
const verifiedData = bookingConfirmationSchema.safeParse(apiJson)
|
||||
if (!verifiedData.success) {
|
||||
updateBookingFailCounter.add(1, {
|
||||
confirmationNumber,
|
||||
|
||||
@@ -12,8 +12,6 @@ export const createBookingSchema = z
|
||||
data: z.object({
|
||||
attributes: z.object({
|
||||
reservationStatus: z.string(),
|
||||
checkInDate: z.string(),
|
||||
checkOutDate: z.string(),
|
||||
paymentUrl: z.string().nullable().optional(),
|
||||
rooms: z
|
||||
.array(
|
||||
@@ -63,8 +61,6 @@ export const createBookingSchema = z
|
||||
reservationStatus: d.data.attributes.reservationStatus,
|
||||
paymentUrl: d.data.attributes.paymentUrl,
|
||||
rooms: d.data.attributes.rooms,
|
||||
checkInDate: d.data.attributes.checkInDate,
|
||||
checkOutDate: d.data.attributes.checkOutDate,
|
||||
errors: d.data.attributes.errors,
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user