diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/index.tsx index 1464641ea..ce0fe5afc 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/index.tsx @@ -20,7 +20,7 @@ export default async function Rooms({ return (
- {(linkedReservations?.length ?? 0 > 0) ? ( + {linkedReservations.length ? ( {intl.formatMessage({ id: "Room {roomIndex}" }, { roomIndex: 1 })} @@ -32,7 +32,7 @@ export default async function Rooms({ />
- {linkedReservations?.map((reservation, idx) => ( + {linkedReservations.map((reservation, idx) => (
{intl.formatMessage( diff --git a/apps/scandic-web/server/routers/booking/output.ts b/apps/scandic-web/server/routers/booking/output.ts index bc5545dde..0b534f814 100644 --- a/apps/scandic-web/server/routers/booking/output.ts +++ b/apps/scandic-web/server/routers/booking/output.ts @@ -2,6 +2,7 @@ import { z } from "zod" import { ChildBedTypeEnum } from "@/constants/booking" +import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" import { phoneValidator } from "@/utils/zod/phoneValidator" import { nullableStringValidator } from "@/utils/zod/stringValidator" @@ -198,10 +199,9 @@ export const bookingConfirmationSchema = z currencyCode: z.string(), guest: guestSchema, isGuaranteedForLateArrival: z.boolean().optional(), - linkedReservations: z - .array(linkedReservationSchema) - .nullish() - .transform((v) => v ?? []), + linkedReservations: nullableArrayObjectValidator( + linkedReservationSchema + ), hotelId: z.string(), packages: z.array(packageSchema).default([]), rateDefinition: rateDefinitionSchema, diff --git a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts index c954a3ac4..67d33273b 100644 --- a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts +++ b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts @@ -12,5 +12,5 @@ export interface BookingConfirmationRoomsProps mainRoom: Room & { bedType: Room["roomTypes"][number] } - linkedReservations?: LinkedReservationSchema[] | null + linkedReservations: LinkedReservationSchema[] }