Revert "chore(SW-303): fetch activity card from CS"
This reverts commit dde9ca190a.
This commit is contained in:
@@ -17,9 +17,6 @@ import {
|
||||
} from "@/server/trpc"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { makeImageVaultImage } from "@/utils/imageVault"
|
||||
import { removeMultipleSlashes } from "@/utils/url"
|
||||
|
||||
import {
|
||||
HotelPageDataRaw,
|
||||
validateHotelPageSchema,
|
||||
@@ -40,7 +37,6 @@ import {
|
||||
import tempFilterData from "./tempFilterData.json"
|
||||
import tempRatesData from "./tempRatesData.json"
|
||||
|
||||
import { HotelBlocksTypenameEnum } from "@/types/components/hotelPage/enums"
|
||||
import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
||||
|
||||
const meter = metrics.getMeter("trpc.hotels")
|
||||
@@ -56,10 +52,7 @@ const availabilityFailCounter = meter.createCounter(
|
||||
"trpc.hotel.availability-fail"
|
||||
)
|
||||
|
||||
async function getContenstackData(
|
||||
locale: string,
|
||||
uid: string | null | undefined
|
||||
) {
|
||||
async function getHotelId(locale: string, uid: string | null | undefined) {
|
||||
const rawContentStackData = await request<HotelPageDataRaw>(GetHotelPage, {
|
||||
locale,
|
||||
uid,
|
||||
@@ -81,7 +74,7 @@ async function getContenstackData(
|
||||
return null
|
||||
}
|
||||
|
||||
return hotelPageData.data.hotel_page
|
||||
return hotelPageData.data.hotel_page.hotel_page_id
|
||||
}
|
||||
|
||||
export const hotelQueryRouter = router({
|
||||
@@ -90,8 +83,7 @@ export const hotelQueryRouter = router({
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { lang, uid } = ctx
|
||||
const { include } = input
|
||||
const contentstackData = await getContenstackData(lang, uid)
|
||||
const hotelId = contentstackData?.hotel_page_id
|
||||
const hotelId = await getHotelId(lang, uid)
|
||||
|
||||
if (!hotelId) {
|
||||
throw notFound(`Hotel not found for uid: ${uid}`)
|
||||
@@ -211,32 +203,6 @@ export const hotelQueryRouter = router({
|
||||
})
|
||||
: []
|
||||
|
||||
const activities = contentstackData?.content
|
||||
? contentstackData.content.map((block: any) => {
|
||||
switch (block.__typename) {
|
||||
case HotelBlocksTypenameEnum.HotelPageContentUpcomingActivitiesCard:
|
||||
return {
|
||||
...block.upcoming_activities_card,
|
||||
background_image: makeImageVaultImage(
|
||||
block.upcoming_activities_card.background_image
|
||||
),
|
||||
contentPage:
|
||||
block.upcoming_activities_card?.hotel_page_activities_content_pageConnection?.edges.map(
|
||||
({ node: contentPage }: { node: any }) => {
|
||||
return {
|
||||
href:
|
||||
contentPage.web?.original_url ||
|
||||
removeMultipleSlashes(
|
||||
`/${contentPage.system.locale}/${contentPage.url}`
|
||||
),
|
||||
}
|
||||
}
|
||||
),
|
||||
}
|
||||
}
|
||||
})[0]
|
||||
: null
|
||||
|
||||
getHotelSuccessCounter.add(1, { hotelId, lang, include })
|
||||
console.info(
|
||||
"api.hotels.hotel success",
|
||||
@@ -253,7 +219,6 @@ export const hotelQueryRouter = router({
|
||||
hotelDetailedFacilities: hotelAttributes.detailedFacilities,
|
||||
hotelImages: images,
|
||||
roomCategories,
|
||||
activitiesCard: activities,
|
||||
}
|
||||
}),
|
||||
availability: router({
|
||||
|
||||
Reference in New Issue
Block a user