feat(sw-697): Added default values
This commit is contained in:
@@ -78,8 +78,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
|
|||||||
? intl.formatMessage<React.ReactNode>(
|
? intl.formatMessage<React.ReactNode>(
|
||||||
{ id: "breakfast.price.free" },
|
{ id: "breakfast.price.free" },
|
||||||
{
|
{
|
||||||
amount: pkg.localPrice?.price,
|
amount: pkg.localPrice.price,
|
||||||
currency: pkg.localPrice?.currency,
|
currency: pkg.localPrice.currency,
|
||||||
free: (str) => <Highlight>{str}</Highlight>,
|
free: (str) => <Highlight>{str}</Highlight>,
|
||||||
strikethrough: (str) => <s>{str}</s>,
|
strikethrough: (str) => <s>{str}</s>,
|
||||||
}
|
}
|
||||||
@@ -87,8 +87,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
|
|||||||
: intl.formatMessage(
|
: intl.formatMessage(
|
||||||
{ id: "breakfast.price" },
|
{ id: "breakfast.price" },
|
||||||
{
|
{
|
||||||
amount: pkg.localPrice?.price,
|
amount: pkg.localPrice.price,
|
||||||
currency: pkg.localPrice?.currency,
|
currency: pkg.localPrice.currency,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ export default function RateSummary({
|
|||||||
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
||||||
)
|
)
|
||||||
|
|
||||||
const petRoomPrice = petRoomPackage?.localPrice?.totalPrice ?? null
|
const petRoomPrice = petRoomPackage?.localPrice.totalPrice ?? null
|
||||||
const petRoomCurrency = petRoomPackage?.localPrice?.currency ?? null
|
const petRoomCurrency = petRoomPackage?.localPrice.currency ?? null
|
||||||
|
|
||||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||||
|
|||||||
@@ -780,7 +780,11 @@ const breakfastPackagePriceSchema = z
|
|||||||
price: z.string(),
|
price: z.string(),
|
||||||
totalPrice: z.string(),
|
totalPrice: z.string(),
|
||||||
})
|
})
|
||||||
.optional() // TODO: Remove optional when the API change has been deployed
|
.default({
|
||||||
|
currency: CurrencyEnum.SEK,
|
||||||
|
price: "0",
|
||||||
|
totalPrice: "0",
|
||||||
|
}) // TODO: Remove optional and default when the API change has been deployed
|
||||||
|
|
||||||
export const breakfastPackageSchema = z.object({
|
export const breakfastPackageSchema = z.object({
|
||||||
code: z.string(),
|
code: z.string(),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||||
|
import { CurrencyEnum } from "@/types/enums/currency"
|
||||||
|
|
||||||
export const getRoomPackagesInputSchema = z.object({
|
export const getRoomPackagesInputSchema = z.object({
|
||||||
hotelId: z.string(),
|
hotelId: z.string(),
|
||||||
@@ -13,11 +14,16 @@ export const getRoomPackagesInputSchema = z.object({
|
|||||||
|
|
||||||
export const packagePriceSchema = z
|
export const packagePriceSchema = z
|
||||||
.object({
|
.object({
|
||||||
currency: z.string(),
|
currency: z.nativeEnum(CurrencyEnum),
|
||||||
price: z.string(),
|
price: z.string(),
|
||||||
totalPrice: z.string(),
|
totalPrice: z.string(),
|
||||||
})
|
})
|
||||||
.optional() // TODO: Remove optional when the API change has been deployed
|
.optional()
|
||||||
|
.default({
|
||||||
|
currency: CurrencyEnum.SEK,
|
||||||
|
price: "0",
|
||||||
|
totalPrice: "0",
|
||||||
|
}) // TODO: Remove optional and default when the API change has been deployed
|
||||||
|
|
||||||
export const packagesSchema = z.object({
|
export const packagesSchema = z.object({
|
||||||
code: z.nativeEnum(RoomPackageCodeEnum),
|
code: z.nativeEnum(RoomPackageCodeEnum),
|
||||||
|
|||||||
Reference in New Issue
Block a user