feat(SW-325): added pois to the list and dynamic map
This commit is contained in:
@@ -216,16 +216,46 @@ const rewardNightSchema = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
const pointsOfInterestSchema = z.object({
|
||||
name: z.string(),
|
||||
distance: z.number(),
|
||||
category: z.object({
|
||||
const poiCategories = z.enum([
|
||||
"Airport",
|
||||
"Amusement park",
|
||||
"Bus terminal",
|
||||
"Fair",
|
||||
"Hospital",
|
||||
"Hotel",
|
||||
"Marketing city",
|
||||
"Museum",
|
||||
"Nearby companies",
|
||||
"Parking / Garage",
|
||||
"Restaurant",
|
||||
"Shopping",
|
||||
"Sports",
|
||||
"Theatre",
|
||||
"Tourist",
|
||||
"Transportations",
|
||||
"Zoo",
|
||||
])
|
||||
|
||||
export const pointOfInterestSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
group: z.string(),
|
||||
}),
|
||||
location: locationSchema,
|
||||
isHighlighted: z.boolean(),
|
||||
})
|
||||
distance: z.number(),
|
||||
category: z.object({
|
||||
name: poiCategories,
|
||||
group: z.string(),
|
||||
}),
|
||||
location: locationSchema,
|
||||
isHighlighted: z.boolean(),
|
||||
})
|
||||
.transform((poi) => ({
|
||||
name: poi.name,
|
||||
distance: poi.distance,
|
||||
category: poi.category.name,
|
||||
coordinates: {
|
||||
lat: poi.location.latitude,
|
||||
lng: poi.location.longitude,
|
||||
},
|
||||
}))
|
||||
|
||||
const parkingPricingSchema = z.object({
|
||||
freeParking: z.boolean(),
|
||||
@@ -454,7 +484,9 @@ export const getHotelDataSchema = z.object({
|
||||
detailedFacilities: z.array(detailedFacilitySchema),
|
||||
healthFacilities: z.array(healthFacilitySchema),
|
||||
rewardNight: rewardNightSchema,
|
||||
pointsOfInterest: z.array(pointsOfInterestSchema),
|
||||
pointsOfInterest: z
|
||||
.array(pointOfInterestSchema)
|
||||
.transform((pois) => pois.sort((a, b) => a.distance - b.distance)),
|
||||
parking: z.array(parkingSchema),
|
||||
specialNeedGroups: z.array(specialNeedGroupSchema),
|
||||
socialMedia: socialMediaSchema,
|
||||
|
||||
@@ -251,6 +251,7 @@ export const hotelQueryRouter = router({
|
||||
hotelRatings: hotelAttributes.ratings,
|
||||
hotelDetailedFacilities: hotelAttributes.detailedFacilities,
|
||||
hotelImages: images,
|
||||
pointsOfInterest: hotelAttributes.pointsOfInterest,
|
||||
roomCategories,
|
||||
activitiesCard: activities,
|
||||
}
|
||||
|
||||
18
server/routers/hotels/utils.ts
Normal file
18
server/routers/hotels/utils.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export function getIconByPoiCategory(category: string) {
|
||||
switch (category) {
|
||||
case "Transportations":
|
||||
return IconName.Train
|
||||
case "Shopping":
|
||||
return IconName.Shopping
|
||||
case "Museum":
|
||||
return IconName.Museum
|
||||
case "Tourist":
|
||||
return IconName.Cultural
|
||||
case "Restaurant":
|
||||
return IconName.Restaurant
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user