fix: avoid localizing currencies and default missing value to N/A
This commit is contained in:
@@ -4,8 +4,6 @@ import { ChildBedTypeEnum } from "@/constants/booking"
|
||||
|
||||
import { phoneValidator } from "@/utils/phoneValidator"
|
||||
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
|
||||
// MUTATION
|
||||
export const createBookingSchema = z
|
||||
.object({
|
||||
@@ -80,7 +78,7 @@ const guestSchema = z.object({
|
||||
|
||||
const packageSchema = z.object({
|
||||
code: z.string().nullable().default(""),
|
||||
currency: z.nativeEnum(CurrencyEnum),
|
||||
currency: z.string(),
|
||||
quantity: z.number().int(),
|
||||
totalPrice: z.number(),
|
||||
totalQuantity: z.number().int(),
|
||||
@@ -110,7 +108,7 @@ export const bookingConfirmationSchema = z
|
||||
extraBedTypes: z.array(extraBedTypesSchema).default([]),
|
||||
computedReservationStatus: z.string().nullable().default(""),
|
||||
confirmationNumber: z.string().nullable().default(""),
|
||||
currencyCode: z.nativeEnum(CurrencyEnum),
|
||||
currencyCode: z.string(),
|
||||
guest: guestSchema,
|
||||
hotelId: z.string(),
|
||||
packages: z.array(packageSchema).default([]),
|
||||
|
||||
@@ -10,7 +10,6 @@ import { specialAlertsSchema } from "./schemas/specialAlerts"
|
||||
import { getPoiGroupByCategoryName } from "./utils"
|
||||
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
import { FacilityEnum } from "@/types/enums/facilities"
|
||||
import { PackageTypeEnum } from "@/types/enums/packages"
|
||||
import type { RestaurantData, RoomData } from "@/types/hotel"
|
||||
@@ -219,7 +218,7 @@ const parkingPricingSchema = z.object({
|
||||
freeParking: z.boolean(),
|
||||
paymentType: z.string().optional(),
|
||||
localCurrency: z.object({
|
||||
currency: z.string().optional(),
|
||||
currency: z.string().default("N/A"),
|
||||
range: z.object({
|
||||
min: z.number().optional(),
|
||||
max: z.number().optional(),
|
||||
@@ -247,7 +246,7 @@ const parkingPricingSchema = z.object({
|
||||
}),
|
||||
requestedCurrency: z
|
||||
.object({
|
||||
currency: z.string().optional(),
|
||||
currency: z.string().default("N/A"),
|
||||
range: z
|
||||
.object({
|
||||
min: z.number().optional(),
|
||||
@@ -493,7 +492,7 @@ const linksSchema = z.object({
|
||||
export const priceSchema = z.object({
|
||||
pricePerNight: z.coerce.number(),
|
||||
pricePerStay: z.coerce.number(),
|
||||
currency: z.nativeEnum(CurrencyEnum),
|
||||
currency: z.string().default("N/A"),
|
||||
})
|
||||
|
||||
export const productTypePriceSchema = z.object({
|
||||
@@ -509,7 +508,7 @@ const productSchema = z.object({
|
||||
rateCode: "",
|
||||
rateType: "",
|
||||
localPrice: {
|
||||
currency: CurrencyEnum.SEK,
|
||||
currency: "N/A",
|
||||
pricePerNight: 0,
|
||||
pricePerStay: 0,
|
||||
},
|
||||
@@ -666,7 +665,7 @@ export const apiCountriesSchema = z.object({
|
||||
.array(
|
||||
z.object({
|
||||
attributes: z.object({
|
||||
currency: z.string().optional(),
|
||||
currency: z.string().default("N/A"),
|
||||
name: z.string(),
|
||||
}),
|
||||
hotelInformationSystemId: z.number().optional(),
|
||||
@@ -813,7 +812,7 @@ export const apiLocationsSchema = z.object({
|
||||
})
|
||||
|
||||
export const packagePriceSchema = z.object({
|
||||
currency: z.nativeEnum(CurrencyEnum),
|
||||
currency: z.string().default("N/A"),
|
||||
price: z.string(),
|
||||
totalPrice: z.string(),
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
|
||||
export const getRoomPackagesInputSchema = z.object({
|
||||
hotelId: z.string(),
|
||||
@@ -14,13 +13,13 @@ export const getRoomPackagesInputSchema = z.object({
|
||||
|
||||
export const packagePriceSchema = z
|
||||
.object({
|
||||
currency: z.nativeEnum(CurrencyEnum),
|
||||
currency: z.string().default("N/A"),
|
||||
price: z.string(),
|
||||
totalPrice: z.string(),
|
||||
})
|
||||
.optional()
|
||||
.default({
|
||||
currency: CurrencyEnum.SEK,
|
||||
currency: "N/A",
|
||||
price: "0",
|
||||
totalPrice: "0",
|
||||
}) // TODO: Remove optional and default when the API change has been deployed
|
||||
|
||||
Reference in New Issue
Block a user