fix: clean up hotel and its typings

This commit is contained in:
Simon Emanuelsson
2024-12-17 16:17:25 +01:00
parent ec74af8814
commit 13a164242f
110 changed files with 1931 additions and 1559 deletions

View File

@@ -4,4 +4,4 @@ export interface BookingConfirmationProps {
confirmationNumber: string
}
export interface ConfirmationProps extends BookingConfirmation {}
export interface ConfirmationProps extends BookingConfirmation { }

View File

@@ -1,19 +1,17 @@
import { type z } from "zod"
import type { z } from "zod"
import type { breakfastFormSchema } from "@/components/HotelReservation/EnterDetails/Breakfast/schema"
import type {
breakfastPackageSchema,
breakfastPackagesSchema,
} from "@/server/routers/hotels/output"
import type { breakfastPackagesSchema } from "@/server/routers/hotels/output"
import type { breakfastPackageSchema } from "@/server/routers/hotels/schemas/packages"
export interface BreakfastFormSchema
extends z.output<typeof breakfastFormSchema> {}
extends z.output<typeof breakfastFormSchema> { }
export interface BreakfastPackages
extends z.output<typeof breakfastPackagesSchema> {}
extends z.output<typeof breakfastPackagesSchema> { }
export interface BreakfastPackage
extends z.output<typeof breakfastPackageSchema> {}
extends z.output<typeof breakfastPackageSchema> { }
export interface BreakfastProps {
packages: BreakfastPackages

View File

@@ -1,7 +1,5 @@
import type { RouterOutput } from "@/lib/trpc/client"
type HotelDataGet = RouterOutput["hotel"]["hotelData"]["get"]
import type { HotelData } from "@/types/hotel"
export interface HotelHeaderProps {
hotelData: NonNullable<HotelDataGet>
hotelData: HotelData
}

View File

@@ -1,7 +1,7 @@
import { RoomConfiguration } from "@/server/routers/hotels/output"
import type { RoomConfiguration } from "@/types/trpc/routers/hotel/roomAvailability"
export interface SelectedRoomProps {
hotelId: string
room: RoomConfiguration
rateDescription: string
room: RoomConfiguration
}

View File

@@ -1,5 +1,5 @@
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
import type { RoomAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
export interface ClientSummaryProps
extends Pick<

View File

@@ -1,6 +1,6 @@
import type { ProductType } from "@/server/routers/hotels/output"
import type { ProductType } from "@/types/trpc/routers/hotel/availability"
export type HotelPriceListProps = {
price: ProductType
hotelId: string
price: ProductType
}

View File

@@ -1,21 +1,21 @@
import type { Hotel } from "@/types/hotel"
import type { ProductType } from "@/server/routers/hotels/output"
import type { ProductType } from "@/types/trpc/routers/hotel/availability"
export enum HotelCardListingTypeEnum {
MapListing = "mapListing",
PageListing = "pageListing",
}
export type HotelCardListingProps = {
hotelData: HotelData[]
type?: HotelCardListingTypeEnum
}
export type HotelData = {
hotelData: Hotel
price: ProductType
}
export type HotelCardListingProps = {
hotelData: HotelData[]
type?: HotelCardListingTypeEnum
}
export interface NullableHotelData extends Omit<HotelData, "hotelData"> {
hotelData: HotelData["hotelData"] | null
}

View File

@@ -1,4 +1,4 @@
import { ProductTypePrices } from "@/server/routers/hotels/output"
import type { ProductTypePrices } from "@/types/trpc/routers/hotel/availability"
export type PriceCardProps = {
productTypePrices: ProductTypePrices

View File

@@ -1,10 +1,9 @@
import type { CheckInData, Hotel, ParkingData } from "@/types/hotel"
import type { HotelLocation } from "@/types/trpc/routers/hotel/locations"
import type { Lang } from "@/constants/languages"
import type {
AlternativeHotelsSearchParams,
SelectHotelSearchParams,
} from "./selectHotelSearchParams"
import type { CheckInData, Hotel, Parking } from "@/types/hotel"
import type { Lang } from "@/constants/languages"
export enum AvailabilityEnum {
Available = "Available",
@@ -23,7 +22,7 @@ export interface ContactProps {
}
export interface ParkingProps {
parking: ParkingData[]
parking: Parking[]
}
export interface AccessibilityProps {

View File

@@ -1,11 +1,13 @@
import type { z } from "zod"
import type {
priceSchema,
Product,
productTypePriceSchema,
RoomConfiguration,
} from "@/server/routers/hotels/output"
} from "@/types/trpc/routers/hotel/roomAvailability"
import type {
priceSchema,
productTypePriceSchema,
} from "@/server/routers/hotels/schemas/productTypePrice"
import type { RoomPackage } from "./roomFilter"
type ProductPrice = z.output<typeof productTypePriceSchema>

View File

@@ -0,0 +1,11 @@
import type { Lang } from "@/constants/languages"
import type { Child } from "./selectRate"
export interface HotelInfoCardProps {
adultCount: number
childArray?: Child[]
fromDate: Date
hotelId: number
lang: Lang
toDate: Date
}

View File

@@ -1,9 +1,9 @@
import type { RoomsAvailability } from "@/server/routers/hotels/output"
import type { RoomPackageData } from "./roomFilter"
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
import type { RoomPackages } from "./roomFilter"
import type { Rate } from "./selectRate"
export interface RateSummaryProps {
isUserLoggedIn: boolean
packages: RoomPackageData | undefined
packages: RoomPackages | undefined
roomsAvailability: RoomsAvailability
}

View File

@@ -1,23 +1,25 @@
import type { z } from "zod"
import type { RoomData } from "@/types/hotel"
import type { Room } from "@/types/hotel"
import type {
packagePriceSchema,
RateDefinition,
RoomConfiguration,
} from "@/server/routers/hotels/output"
} from "@/types/trpc/routers/hotel/roomAvailability"
import type { packagePriceSchema } from "@/server/routers/hotels/schemas/packages"
import type { RoomPriceSchema } from "./flexibilityOption"
import type { RoomPackageCodes, RoomPackageData } from "./roomFilter"
import type { RoomPackageCodes, RoomPackages } from "./roomFilter"
import type { RateCode } from "./selectRate"
export type RoomCardProps = {
hotelId: string
hotelType: string | undefined
roomConfiguration: RoomConfiguration
rateDefinitions: RateDefinition[]
roomCategories: RoomData[]
roomCategories: Room[]
selectedPackages: RoomPackageCodes[]
packages: RoomPackageData | undefined
roomListIndex: number
packages: RoomPackages | undefined
handleSelectRate: React.Dispatch<React.SetStateAction<RateCode | undefined>>
}
type RoomPackagePriceSchema = z.output<typeof packagePriceSchema>

View File

@@ -1,6 +1,6 @@
import type { z } from "zod"
import type { packagesSchema } from "@/server/routers/hotels/output"
import type { packageSchema } from "@/server/routers/hotels/schemas/packages"
export enum RoomPackageCodeEnum {
PET_ROOM = "PETR",
@@ -24,7 +24,6 @@ export interface RoomFilterProps {
roomListIndex: number
}
export type RoomPackage = z.output<typeof packagesSchema>
export interface RoomPackageData extends Array<RoomPackage> {}
export type RoomPackage = z.output<typeof packageSchema>
export type RoomPackageCodes = RoomPackage["code"]
export type RoomPackages = RoomPackage[]

View File

@@ -1,31 +1,32 @@
import type { RoomData } from "@/types/hotel"
import type { RoomsAvailability } from "@/server/routers/hotels/output"
import type {
DefaultFilterOptions,
RoomPackage,
RoomPackageCodes,
RoomPackageData,
RoomPackages,
} from "./roomFilter"
import type { Room } from "@/types/hotel"
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
export interface RoomTypeListProps {
roomsAvailability: RoomsAvailability
roomCategories: RoomData[]
availablePackages: RoomPackageData | undefined
roomCategories: Room[]
availablePackages: RoomPackage | undefined
selectedPackages: RoomPackageCodes[]
hotelType: string | undefined
roomListIndex: number
}
export interface SelectRateProps {
roomsAvailability: RoomsAvailability
roomCategories: RoomData[]
availablePackages: RoomPackageData
availablePackages: RoomPackages
hotelType: string | undefined
isUserLoggedIn: boolean
roomsAvailability: RoomsAvailability
roomCategories: Room[]
}
export interface RoomSelectionPanelProps {
roomCategories: RoomData[]
roomCategories: Room[]
availablePackages: RoomPackage[]
selectedPackages: RoomPackageCodes[]
hotelType: string | undefined

View File

@@ -0,0 +1,11 @@
import type { Lang } from "@/constants/languages"
import type { Child } from "./selectRate"
export interface RoomsContainerProps {
adultCount: number
childArray?: Child[]
fromDate: Date
hotelId: number
lang: Lang
toDate: Date
}

View File

@@ -1,4 +1,7 @@
import type { Product, RoomConfiguration } from "@/server/routers/hotels/output"
import type {
Product,
RoomConfiguration,
} from "@/types/trpc/routers/hotel/roomAvailability"
import type { ChildBedMapEnum } from "../../bookingWidget/enums"
import type { RoomPackageCodeEnum } from "./roomFilter"

View File

@@ -1,10 +1,10 @@
import { Hotel } from "@/types/hotel"
import { HotelData } from "@/types/hotel"
export enum SidePeekEnum {
hotelDetails = "hotel-detail-side-peek",
roomDetails = "room-detail-side-peek",
}
export type SidePeekProps = {
hotel: Hotel
export type HotelReservationSidePeekProps = {
hotel: HotelData | null
}

View File

@@ -5,11 +5,11 @@ import type {
Price,
RoomPrice,
} from "@/types/stores/enter-details"
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
import type { BedTypeSchema } from "./enterDetails/bedType"
import type { BreakfastPackage } from "./enterDetails/breakfast"
import type { DetailsSchema } from "./enterDetails/details"
import type { Child, SelectRateSearchParams } from "./selectRate/selectRate"
import type { RoomAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
export type RoomsData = Pick<DetailsState, "roomPrice"> &
Pick<RoomAvailability, "cancellationText" | "rateDetails"> &
@@ -21,7 +21,7 @@ export type RoomsData = Pick<DetailsState, "roomPrice"> &
export interface SummaryProps
extends Pick<RoomAvailability, "cancellationText" | "rateDetails">,
Pick<RoomAvailability["selectedRoom"], "roomType"> {
Pick<RoomAvailability["selectedRoom"], "roomType"> {
isMember: boolean
breakfastIncluded: boolean
}