diff --git a/server/routers/contentstack/hotelPage/output.ts b/server/routers/contentstack/hotelPage/output.ts index d82ec0ac3..347df6e17 100644 --- a/server/routers/contentstack/hotelPage/output.ts +++ b/server/routers/contentstack/hotelPage/output.ts @@ -30,7 +30,7 @@ const contentBlockActivity = z.object({ __typename: z.literal( HotelBlocksTypenameEnum.HotelPageContentUpcomingActivitiesCard ), - upcoming_activities_card: activityCardSchema.optional(), + upcoming_activities_card: activityCardSchema, }) const contentBlockItem = z.discriminatedUnion("__typename", [ @@ -61,3 +61,4 @@ type HotelPageRaw = HotelPageDataRaw["hotel_page"] export type HotelPage = HotelPageRaw export type ActivityCard = z.infer +export type ContentBlockItem = z.infer diff --git a/server/routers/hotels/query.ts b/server/routers/hotels/query.ts index 755644dfb..b35ed7cd2 100644 --- a/server/routers/hotels/query.ts +++ b/server/routers/hotels/query.ts @@ -21,7 +21,8 @@ import { makeImageVaultImage } from "@/utils/imageVault" import { removeMultipleSlashes } from "@/utils/url" import { - HotelPageDataRaw, + type ContentBlockItem, + type HotelPageDataRaw, validateHotelPageSchema, } from "../contentstack/hotelPage/output" import { @@ -212,13 +213,13 @@ export const hotelQueryRouter = router({ : [] const activities = contentstackData?.content - ? contentstackData.content.map((block: any) => { + ? contentstackData.content.map((block: ContentBlockItem) => { switch (block.__typename) { case HotelBlocksTypenameEnum.HotelPageContentUpcomingActivitiesCard: return { ...block.upcoming_activities_card, background_image: makeImageVaultImage( - block.upcoming_activities_card.background_image + block.upcoming_activities_card?.background_image ), contentPage: block.upcoming_activities_card?.hotel_page_activities_content_pageConnection?.edges.map(