feat(SW-325): added additional poi groups
This commit is contained in:
@@ -2,6 +2,13 @@ import { z } from "zod"
|
||||
|
||||
import { toLang } from "@/server/utils"
|
||||
|
||||
import { getPoiGroupByCategoryName } from "./utils"
|
||||
|
||||
import {
|
||||
PointOfInterestCategoryNameEnum,
|
||||
PointOfInterestGroupEnum,
|
||||
} from "@/types/hotel"
|
||||
|
||||
const ratingsSchema = z
|
||||
.object({
|
||||
tripAdvisor: z.object({
|
||||
@@ -213,32 +220,15 @@ const rewardNightSchema = 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",
|
||||
])
|
||||
const poiGroups = z.nativeEnum(PointOfInterestGroupEnum)
|
||||
const poiCategoryNames = z.nativeEnum(PointOfInterestCategoryNameEnum)
|
||||
|
||||
export const pointOfInterestSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
distance: z.number(),
|
||||
category: z.object({
|
||||
name: poiCategories,
|
||||
name: poiCategoryNames,
|
||||
group: z.string(),
|
||||
}),
|
||||
location: locationSchema,
|
||||
@@ -247,7 +237,8 @@ export const pointOfInterestSchema = z
|
||||
.transform((poi) => ({
|
||||
name: poi.name,
|
||||
distance: poi.distance,
|
||||
category: poi.category.name,
|
||||
categoryName: poi.category.name,
|
||||
group: getPoiGroupByCategoryName(poi.category.name),
|
||||
coordinates: {
|
||||
lat: poi.location.latitude,
|
||||
lng: poi.location.longitude,
|
||||
|
||||
Reference in New Issue
Block a user