From 4c9605ef3f1a037ec17d156c4c4b7d1c6c41b95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matilda=20Landstr=C3=B6m?= Date: Tue, 26 Aug 2025 06:38:40 +0000 Subject: [PATCH] Merged in fix/SW-2528 (pull request #2688) fix(SW-2528): get correct restaurant type * fix(SW-2528): get correct type Approved-by: Erik Tiekstra --- .../RestaurantBar/RestaurantBarItem/index.tsx | 7 +++- .../schemas/hotel/include/restaurants.ts | 39 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/RestaurantBar/RestaurantBarItem/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/RestaurantBar/RestaurantBarItem/index.tsx index 013d9747c..30abe7619 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/RestaurantBar/RestaurantBarItem/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/RestaurantBar/RestaurantBarItem/index.tsx @@ -26,7 +26,7 @@ export default async function RestaurantBarItem({ menus, restaurantPage, mainBody, - type, + restaurantType, } = restaurant const visibleImages = restaurant.content.images.slice(0, 2) @@ -37,7 +37,10 @@ export default async function RestaurantBarItem({ return (
- +

{name}

diff --git a/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts index 5913dd64f..bd595cf07 100644 --- a/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts @@ -75,23 +75,28 @@ const openingDetailsSchema = z.object({ }) export const restaurantsSchema = z.object({ - attributes: z.object({ - bookTableUrl: nullableStringValidator, - content: contentSchema, - elevatorPitch: z.string().optional(), - email: z.string().email().optional(), - externalBreakfast: externalBreakfastSchema, - isPublished: z.boolean().default(false), - mainBody: z.string().optional(), - menus: z.array(menuItemSchema).default([]), - name: z.string().default(""), - nameInUrl: z.string().optional(), - openingDetails: z.array(openingDetailsSchema).default([]), - phoneNumber: z.string().optional(), - restaurantPage: z.boolean().default(false), - specialAlerts: specialAlertsSchema, - type: z.string(), - }), + attributes: z + .object({ + bookTableUrl: nullableStringValidator, + content: contentSchema, + elevatorPitch: z.string().optional(), + email: z.string().email().optional(), + externalBreakfast: externalBreakfastSchema, + isPublished: z.boolean().default(false), + mainBody: z.string().optional(), + menus: z.array(menuItemSchema).default([]), + name: z.string().default(""), + nameInUrl: z.string().optional(), + openingDetails: z.array(openingDetailsSchema).default([]), + phoneNumber: z.string().optional(), + restaurantPage: z.boolean().default(false), + specialAlerts: specialAlertsSchema, + type: z.string(), + }) + .transform(({ type, ...rest }) => ({ + ...rest, + restaurantType: type, + })), id: z.string(), type: z.literal("restaurants"), })