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