fix: cache hotel response

This commit is contained in:
Simon Emanuelsson
2024-12-17 16:18:46 +01:00
parent 13a164242f
commit 1deab000bd
38 changed files with 339 additions and 246 deletions

View File

@@ -1,3 +1,3 @@
import { passwordValidators } from "@/utils/passwordValidator"
import type { passwordValidators } from "@/utils/zod/passwordValidator"
export type PasswordValidatorKey = keyof typeof passwordValidators

View File

@@ -1,9 +1,5 @@
import type {
Hotel,
Restaurant,
RestaurantOpeningHours,
} from "@/types/hotel"
import type { ParkingAmenityProps } from "./parking"
import type { Hotel, Restaurant, RestaurantOpeningHours } from "@/types/hotel"
export type AmenitiesSidePeekProps = {
amenitiesList: Hotel["detailedFacilities"]

View File

@@ -8,7 +8,6 @@ import type {
import type { packagePriceSchema } from "@/server/routers/hotels/schemas/packages"
import type { RoomPriceSchema } from "./flexibilityOption"
import type { RoomPackageCodes, RoomPackages } from "./roomFilter"
import type { RateCode } from "./selectRate"
export type RoomCardProps = {
hotelId: string
@@ -19,7 +18,6 @@ export type RoomCardProps = {
selectedPackages: RoomPackageCodes[]
roomListIndex: number
packages: RoomPackages | undefined
handleSelectRate: React.Dispatch<React.SetStateAction<RateCode | undefined>>
}
type RoomPackagePriceSchema = z.output<typeof packagePriceSchema>

View File

@@ -1,17 +1,15 @@
import type { Room } from "@/types/hotel"
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
import type {
DefaultFilterOptions,
RoomPackage,
RoomPackageCodes,
RoomPackages,
} from "./roomFilter"
import type { Room } from "@/types/hotel"
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
export interface RoomTypeListProps {
roomsAvailability: RoomsAvailability
roomCategories: Room[]
availablePackages: RoomPackage | undefined
availablePackages: RoomPackages | undefined
selectedPackages: RoomPackageCodes[]
hotelType: string | undefined
roomListIndex: number
@@ -27,7 +25,7 @@ export interface SelectRateProps {
export interface RoomSelectionPanelProps {
roomCategories: Room[]
availablePackages: RoomPackage[]
availablePackages: RoomPackages
selectedPackages: RoomPackageCodes[]
hotelType: string | undefined
defaultPackages: DefaultFilterOptions[]

8
types/enums/currency.ts Normal file
View File

@@ -0,0 +1,8 @@
export enum CurrencyEnum {
DKK = "DKK",
EUR = "EUR",
NOK = "NOK",
PLN = "PLN",
SEK = "SEK",
Unknown = "Unknown",
}

View File

@@ -7,18 +7,20 @@ import type { addressSchema } from "@/server/routers/hotels/schemas/hotel/addres
import type { hotelContentSchema } from "@/server/routers/hotels/schemas/hotel/content"
import type { detailedFacilitiesSchema } from "@/server/routers/hotels/schemas/hotel/detailedFacility"
import type { checkinSchema } from "@/server/routers/hotels/schemas/hotel/facts"
import type { healthFacilitySchema } from "@/server/routers/hotels/schemas/hotel/healthFacilities"
import type { nearbyHotelsSchema } from "@/server/routers/hotels/schemas/hotel/include/nearbyHotels"
import type { restaurantsSchema } from "@/server/routers/hotels/schemas/hotel/include/restaurants"
import type {
openingHoursDetailsSchema,
openingHoursSchema,
restaurantsSchema,
} from "@/server/routers/hotels/schemas/hotel/include/restaurants"
import type { transformRoomCategories } from "@/server/routers/hotels/schemas/hotel/include/roomCategories"
import type { locationSchema } from "@/server/routers/hotels/schemas/hotel/location"
import type { parkingSchema } from "@/server/routers/hotels/schemas/hotel/parking"
import type { pointOfInterestSchema } from "@/server/routers/hotels/schemas/hotel/poi"
import type { ratingsSchema } from "@/server/routers/hotels/schemas/hotel/rating"
import type { imageSchema } from "@/server/routers/hotels/schemas/image"
import { restaurantOpeningHoursSchema } from "@/server/routers/hotels/schemas/restaurants"
import { healthFacilitySchema } from "@/server/routers/hotels/schemas/hotel/healthFacilities"
import type {
additionalDataSchema,
extraPageSchema,
facilitySchema,
transformAdditionalData,
@@ -45,9 +47,12 @@ export type NearbyHotel = Pick<NearbyHotelsSchema, "id" | "type"> &
export type Parking = z.output<typeof parkingSchema>
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
type RestaurantSchema = z.output<typeof restaurantsSchema>
export type RestaurantOpeningHours = z.output<typeof restaurantOpeningHoursSchema>
export type Restaurant = Pick<RestaurantSchema, "id" | "type"> &
RestaurantSchema["attributes"]
export type RestaurantOpeningHours = z.output<typeof openingHoursSchema>
export type RestaurantOpeningHoursDay = z.output<
typeof openingHoursDetailsSchema
>
export type Room = ReturnType<typeof transformRoomCategories>
export type HotelMapContentProps = {

View File

@@ -7,3 +7,6 @@ import type { productTypePriceSchema } from "@/server/routers/hotels/schemas/pro
export type HotelsAvailability = z.output<typeof hotelsAvailabilitySchema>
export type ProductType = z.output<typeof productTypeSchema>
export type ProductTypePrices = z.output<typeof productTypePriceSchema>
export type HotelsAvailabilityItem =
HotelsAvailability["data"][number]["attributes"]