fix(SW-769): removed categoryname enum from pointOfInterestSchema and use z.string() instead
This commit is contained in:
@@ -13,7 +13,6 @@ import { AlertTypeEnum } from "@/types/enums/alert"
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
import { FacilityEnum } from "@/types/enums/facilities"
|
||||
import { PackageTypeEnum } from "@/types/enums/packages"
|
||||
import { PointOfInterestCategoryNameEnum } from "@/types/hotel"
|
||||
|
||||
const ratingsSchema = z
|
||||
.object({
|
||||
@@ -199,14 +198,12 @@ const rewardNightSchema = z.object({
|
||||
}),
|
||||
})
|
||||
|
||||
const poiCategoryNames = z.nativeEnum(PointOfInterestCategoryNameEnum)
|
||||
|
||||
export const pointOfInterestSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
distance: z.number(),
|
||||
category: z.object({
|
||||
name: poiCategoryNames,
|
||||
name: z.string(),
|
||||
group: z.string(),
|
||||
}),
|
||||
location: locationSchema,
|
||||
|
||||
@@ -12,39 +12,34 @@ import {
|
||||
type Countries,
|
||||
} from "./output"
|
||||
|
||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||
import {
|
||||
PointOfInterestCategoryNameEnum,
|
||||
PointOfInterestGroupEnum,
|
||||
} from "@/types/hotel"
|
||||
import { HotelLocation } from "@/types/trpc/routers/hotel/locations"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { Endpoint } from "@/lib/api/endpoints"
|
||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||
import { PointOfInterestGroupEnum } from "@/types/hotel"
|
||||
import { HotelLocation } from "@/types/trpc/routers/hotel/locations"
|
||||
|
||||
export function getPoiGroupByCategoryName(
|
||||
category: PointOfInterestCategoryNameEnum
|
||||
) {
|
||||
export function getPoiGroupByCategoryName(category: string) {
|
||||
switch (category) {
|
||||
case PointOfInterestCategoryNameEnum.AIRPORT:
|
||||
case PointOfInterestCategoryNameEnum.BUS_TERMINAL:
|
||||
case PointOfInterestCategoryNameEnum.TRANSPORTATIONS:
|
||||
case "Airport":
|
||||
case "Bus terminal":
|
||||
case "Transportations":
|
||||
return PointOfInterestGroupEnum.PUBLIC_TRANSPORT
|
||||
case PointOfInterestCategoryNameEnum.AMUSEMENT_PARK:
|
||||
case PointOfInterestCategoryNameEnum.MUSEUM:
|
||||
case PointOfInterestCategoryNameEnum.SPORTS:
|
||||
case PointOfInterestCategoryNameEnum.THEATRE:
|
||||
case PointOfInterestCategoryNameEnum.TOURIST:
|
||||
case PointOfInterestCategoryNameEnum.ZOO:
|
||||
case "Amusement park":
|
||||
case "Museum":
|
||||
case "Sports":
|
||||
case "Theatre":
|
||||
case "Tourist":
|
||||
case "Zoo":
|
||||
return PointOfInterestGroupEnum.ATTRACTIONS
|
||||
case PointOfInterestCategoryNameEnum.NEARBY_COMPANIES:
|
||||
case PointOfInterestCategoryNameEnum.FAIR:
|
||||
case "Nearby companies":
|
||||
case "Fair":
|
||||
return PointOfInterestGroupEnum.BUSINESS
|
||||
case PointOfInterestCategoryNameEnum.PARKING_GARAGE:
|
||||
case "Parking / Garage":
|
||||
return PointOfInterestGroupEnum.PARKING
|
||||
case PointOfInterestCategoryNameEnum.SHOPPING:
|
||||
case PointOfInterestCategoryNameEnum.RESTAURANT:
|
||||
case "Shopping":
|
||||
case "Restaurant":
|
||||
return PointOfInterestGroupEnum.SHOPPING_DINING
|
||||
case PointOfInterestCategoryNameEnum.HOSPITAL:
|
||||
case "Hospital":
|
||||
default:
|
||||
return PointOfInterestGroupEnum.LOCATION
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user