fix(SW-302): add facility ID enum

This commit is contained in:
Matilda Landström
2024-10-01 11:02:59 +02:00
parent 1d8319bfcb
commit d78218801f
2 changed files with 12 additions and 2 deletions

View File

@@ -24,3 +24,9 @@ export enum RestaurantHeadings {
restaurant = "Restaurant", restaurant = "Restaurant",
breakfastRestaurant = "Breakfast restaurant", breakfastRestaurant = "Breakfast restaurant",
} }
export enum FacilityIds {
bar = 1606,
rooftopBar = 1014,
restaurant = 1383,
}

View File

@@ -11,6 +11,7 @@ import {
type Facilities, type Facilities,
type FacilityCards, type FacilityCards,
FacilityEnum, FacilityEnum,
FacilityIds,
RestaurantHeadings, RestaurantHeadings,
} from "@/types/components/hotelPage/facilities" } from "@/types/components/hotelPage/facilities"
import type { ImageVaultAsset } from "@/types/components/imageVault" import type { ImageVaultAsset } from "@/types/components/imageVault"
@@ -141,9 +142,12 @@ export async function setFacilityCards(
export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings { export function getRestaurantHeading(amenities: Amenities): RestaurantHeadings {
const hasBar = amenities.some( const hasBar = amenities.some(
(facility) => facility.id == 1606 || facility.id == 1014 // bar & rooftop bar id (facility) =>
facility.id == FacilityIds.bar || facility.id == FacilityIds.rooftopBar
)
const hasRestaurant = amenities.some(
(facility) => facility.id == FacilityIds.restaurant
) )
const hasRestaurant = amenities.some((facility) => facility.id == 1383) // restaurant id
if (hasBar && hasRestaurant) { if (hasBar && hasRestaurant) {
return RestaurantHeadings.restaurantAndBar return RestaurantHeadings.restaurantAndBar