fix: handle undefined values schemas
This commit is contained in:
@@ -150,13 +150,13 @@ export default function RoomCard({
|
||||
</div>
|
||||
|
||||
<div className={styles.specification}>
|
||||
{occupancy && (
|
||||
{occupancy?.total && (
|
||||
<Caption color="uiTextMediumContrast" className={styles.guests}>
|
||||
{intl.formatMessage(
|
||||
{
|
||||
id: "booking.guests",
|
||||
},
|
||||
{ nrOfGuests: occupancy?.total }
|
||||
{ nrOfGuests: occupancy.total }
|
||||
)}
|
||||
</Caption>
|
||||
)}
|
||||
|
||||
@@ -37,14 +37,16 @@ export const restaurantSchema = z
|
||||
.object({
|
||||
attributes: z.object({
|
||||
name: z.string().optional(),
|
||||
isPublished: z.boolean(),
|
||||
isPublished: z.boolean().default(false),
|
||||
email: z.string().optional(),
|
||||
phoneNumber: z.string().optional(),
|
||||
externalBreakfast: z.object({
|
||||
isAvailable: z.boolean(),
|
||||
localPriceForExternalGuests: restaurantPriceSchema.optional(),
|
||||
requestedPriceForExternalGuests: restaurantPriceSchema.optional(),
|
||||
}),
|
||||
externalBreakfast: z
|
||||
.object({
|
||||
isAvailable: z.boolean(),
|
||||
localPriceForExternalGuests: restaurantPriceSchema.optional(),
|
||||
requestedPriceForExternalGuests: restaurantPriceSchema.optional(),
|
||||
})
|
||||
.optional(),
|
||||
menus: z
|
||||
.array(
|
||||
z.object({
|
||||
@@ -53,7 +55,7 @@ export const restaurantSchema = z
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
openingDetails: z.array(restaurantOpeningDetailSchema),
|
||||
openingDetails: z.array(restaurantOpeningDetailSchema).default([]),
|
||||
content: z.object({
|
||||
images: z.array(imageSchema),
|
||||
texts: z.object({
|
||||
|
||||
@@ -63,9 +63,9 @@ export const roomSchema = z
|
||||
roomTypes: z.array(roomTypesSchema),
|
||||
roomFacilities: z.array(roomFacilitiesSchema),
|
||||
occupancy: z.object({
|
||||
total: z.number(),
|
||||
adults: z.number(),
|
||||
children: z.number(),
|
||||
total: z.number().optional(),
|
||||
adults: z.number().optional(),
|
||||
children: z.number().optional(),
|
||||
}),
|
||||
roomSize: z.object({
|
||||
min: z.number(),
|
||||
|
||||
Reference in New Issue
Block a user