diff --git a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx index 9578ba244..4988714a7 100644 --- a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx +++ b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx @@ -81,7 +81,6 @@ export default async function DestinationCityPage() {
- countryConnection.edges[0].node.destination_settings.country - ), city_denmark: z.string().optional().nullable(), city_finland: z.string().optional().nullable(), city_germany: z.string().optional().nullable(), @@ -47,7 +29,6 @@ export const destinationCityPageSchema = z }) .transform( ({ - countryConnection: country, city_denmark, city_finland, city_germany, @@ -55,22 +36,16 @@ export const destinationCityPageSchema = z city_poland, city_sweden, }) => { - switch (country) { - case Country.Denmark: - return { country, city: city_denmark } - case Country.Finland: - return { country, city: city_finland } - case Country.Germany: - return { country, city: city_germany } - case Country.Poland: - return { country, city: city_poland } - case Country.Norway: - return { country, city: city_norway } - case Country.Sweden: - return { country, city: city_sweden } - default: - throw new Error(`Invalid country: ${country}`) - } + const cities = [ + city_denmark, + city_finland, + city_germany, + city_poland, + city_norway, + city_sweden, + ].filter((city): city is string => Boolean(city)) + + return { city: cities[0] } } ), heading: z.string(), @@ -145,15 +120,6 @@ export const destinationCityPageSchema = z /** REFS */ export const destinationCityPageRefsSchema = z.object({ destination_city_page: z.object({ - destination_settings: z.object({ - countryConnection: z.object({ - edges: z.array( - z.object({ - node: destinationCountryPageRefSchema, - }) - ), - }), - }), sidepeek_content: z.object({ content: z.object({ embedded_itemsConnection: z.object({ diff --git a/server/routers/contentstack/destinationCityPage/utils.ts b/server/routers/contentstack/destinationCityPage/utils.ts index 767a04170..8f2b1fcf4 100644 --- a/server/routers/contentstack/destinationCityPage/utils.ts +++ b/server/routers/contentstack/destinationCityPage/utils.ts @@ -19,12 +19,6 @@ export function getConnections({ destination_city_page, }: GetDestinationCityPageRefsSchema) { const connections: System["system"][] = [destination_city_page.system] - - connections.push( - destination_city_page.destination_settings.countryConnection.edges[0].node - .system - ) - if (destination_city_page.sidepeek_content) { destination_city_page.sidepeek_content.content.embedded_itemsConnection.edges.forEach( ({ node }) => {