Merged in feat/SW-1737-design-mystay-multiroom (pull request #1565)
Feat/SW-1737 design mystay multiroom * feat(SW-1737) Fixed member view of guest details * feat(SW-1737) fix merge issues * feat(SW-1737) Fixed price details * feat(SW-1737) removed unused imports * feat(SW-1737) removed true as statement * feat(SW-1737) updated store handling * feat(SW-1737) fixed bug showing double numbers * feat(SW-1737) small design fixed * feat(SW-1737) fixed rebase errors * feat(SW-1737) fixed create booking error with dates * feat(SW-1737) fixed view multiroom as singleroom * feat(SW-1737) fixes for multiroom * feat(SW-1737) fixed bookingsummary * feat(SW-1737) dont hide modify dates * feat(SW-1737) updated breakfast to handle number * feat(SW-1737) Added red color if member rate * feat(SW-1737) fix PR comments * feat(SW-1737) updated member tiers svg * feat(SW-1737) updated how to handle paymentMethodDescription * feat(SW-1737) fixes after testing mystay * feat(SW-1737) updated Room type to just use whats used * feat(SW-1737) fixed access * feat(SW-1737) refactor my stay after PR comments * feat(SW-1737) fix roomNumber translation * feat(SW-1737) removed log Approved-by: Arvid Norlin
This commit is contained in:
@@ -158,6 +158,7 @@ export const bookingMutationRouter = router({
|
||||
}
|
||||
|
||||
const apiJson = await apiResponse.json()
|
||||
|
||||
const verifiedData = createBookingSchema.safeParse(apiJson)
|
||||
if (!verifiedData.success) {
|
||||
createBookingFailCounter.add(1, {
|
||||
@@ -319,6 +320,7 @@ export const bookingMutationRouter = router({
|
||||
}
|
||||
|
||||
const apiJson = await apiResponse.json()
|
||||
|
||||
const verifiedData = createBookingSchema.safeParse(apiJson)
|
||||
|
||||
if (!verifiedData.success) {
|
||||
|
||||
@@ -3,7 +3,22 @@ import { z } from "zod"
|
||||
import { BookingStatusEnum, ChildBedTypeEnum } from "@/constants/booking"
|
||||
|
||||
import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator"
|
||||
import { nullableStringValidator } from "@/utils/zod/stringValidator"
|
||||
import { nullableIntValidator } from "@/utils/zod/numberValidator"
|
||||
import {
|
||||
nullableStringEmailValidator,
|
||||
nullableStringValidator,
|
||||
} from "@/utils/zod/stringValidator"
|
||||
|
||||
const guestSchema = z.object({
|
||||
email: nullableStringEmailValidator,
|
||||
firstName: nullableStringValidator,
|
||||
lastName: nullableStringValidator,
|
||||
membershipNumber: nullableStringValidator,
|
||||
phoneNumber: nullableStringValidator,
|
||||
countryCode: nullableStringValidator,
|
||||
})
|
||||
|
||||
export type Guest = z.output<typeof guestSchema>
|
||||
|
||||
// MUTATION
|
||||
export const createBookingSchema = z
|
||||
@@ -11,6 +26,7 @@ export const createBookingSchema = z
|
||||
data: z.object({
|
||||
attributes: z.object({
|
||||
reservationStatus: z.string(),
|
||||
guest: guestSchema.optional(),
|
||||
paymentUrl: z.string().nullable().optional(),
|
||||
rooms: z
|
||||
.array(
|
||||
@@ -61,6 +77,7 @@ export const createBookingSchema = z
|
||||
paymentUrl: d.data.attributes.paymentUrl,
|
||||
rooms: d.data.attributes.rooms,
|
||||
errors: d.data.attributes.errors,
|
||||
guest: d.data.attributes.guest,
|
||||
}))
|
||||
|
||||
// QUERY
|
||||
@@ -70,17 +87,6 @@ const childBedPreferencesSchema = z.object({
|
||||
code: z.string().nullable().default(""),
|
||||
})
|
||||
|
||||
const guestSchema = z.object({
|
||||
email: z.string().email().nullable().default(""),
|
||||
firstName: z.string().nullable().default(""),
|
||||
lastName: z.string().nullable().default(""),
|
||||
membershipNumber: z.string().nullable().default(""),
|
||||
phoneNumber: z.string().nullable().default(""),
|
||||
countryCode: z.string().nullable().default(""),
|
||||
})
|
||||
|
||||
export type Guest = z.output<typeof guestSchema>
|
||||
|
||||
export const packageSchema = z
|
||||
.object({
|
||||
type: z.string().nullish(),
|
||||
@@ -92,6 +98,7 @@ export const packageSchema = z
|
||||
totalPrice: z.number().nullish(),
|
||||
totalUnit: z.number().int().nullish(),
|
||||
currency: z.string().default(""),
|
||||
points: nullableIntValidator,
|
||||
}),
|
||||
comment: z.string().nullish(),
|
||||
})
|
||||
@@ -101,6 +108,7 @@ export const packageSchema = z
|
||||
comment: packageData.comment,
|
||||
code: packageData.code,
|
||||
currency: packageData.price.currency,
|
||||
points: packageData.price.points ?? null,
|
||||
totalPrice: packageData.price.totalPrice ?? 0,
|
||||
totalUnit: packageData.price.totalUnit ?? 0,
|
||||
unit: packageData.price.unit ?? 0,
|
||||
@@ -125,7 +133,7 @@ const rateDefinitionSchema = z.object({
|
||||
generalTerms: z.array(z.string()).default([]),
|
||||
isMemberRate: z.boolean().default(false),
|
||||
mustBeGuaranteed: z.boolean().default(false),
|
||||
rateCode: z.string().nullable().default(""),
|
||||
rateCode: z.string().default(""),
|
||||
title: z.string().nullable().default(""),
|
||||
})
|
||||
|
||||
@@ -220,7 +228,7 @@ export const bookingConfirmationSchema = z
|
||||
rateDefinition: rateDefinitionSchema,
|
||||
reservationStatus: z.string().nullable().default(""),
|
||||
roomPrice: z.number(),
|
||||
roomTypeCode: z.string().nullable().default(""),
|
||||
roomTypeCode: z.string().default(""),
|
||||
totalPrice: z.number(),
|
||||
totalPriceExVat: z.number(),
|
||||
vatAmount: z.number(),
|
||||
|
||||
Reference in New Issue
Block a user