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

@@ -1,20 +1,17 @@
import type { z } from "zod"
import type { Hotel, RoomData } from "@/types/hotel"
import type { Hotel, Room } from "@/types/hotel"
import type { bookingConfirmationSchema } from "@/server/routers/booking/output"
export interface BookingConfirmationSchema
extends z.output<typeof bookingConfirmationSchema> {}
extends z.output<typeof bookingConfirmationSchema> { }
export interface BookingConfirmation {
booking: BookingConfirmationSchema
hotel: Hotel & {
included?: {
rooms: RoomData[] | undefined
}
}
hotel: Hotel
room:
| (RoomData & {
bedType: RoomData["roomTypes"][number]
})
| null
| (Room & {
bedType: Room["roomTypes"][number]
})
| null
}

View File

@@ -1,5 +1,9 @@
import type { RouterOutput } from "@/lib/trpc/client"
import type { z } from "zod"
export type RoomAvailability = NonNullable<
RouterOutput["hotel"]["availability"]["room"]
>
import type { hotelsAvailabilitySchema } from "@/server/routers/hotels/output"
import type { productTypeSchema } from "@/server/routers/hotels/schemas/availability/productType"
import type { productTypePriceSchema } from "@/server/routers/hotels/schemas/productTypePrice"
export type HotelsAvailability = z.output<typeof hotelsAvailabilitySchema>
export type ProductType = z.output<typeof productTypeSchema>
export type ProductTypePrices = z.output<typeof productTypePriceSchema>

View File

@@ -0,0 +1,5 @@
import type { z } from "zod"
import type { hotelFilterSchema } from "@/server/routers/hotels/schemas/hotelFilter"
export type HotelFilter = z.output<typeof hotelFilterSchema>

View File

@@ -0,0 +1,12 @@
import type { z } from "zod"
import type { Room } from "@/types/hotel"
import type {
cityCoordinatesInputSchema,
hotelInputSchema,
} from "@/server/routers/hotels/input"
export type CityCoordinatesInput = z.input<typeof cityCoordinatesInputSchema>
export type HotelInput = z.input<typeof hotelInputSchema>
export type RoomType = Pick<Room, "roomTypes" | "name">

View File

@@ -1,8 +1,12 @@
import type { z } from "zod"
import type { apiLocationsSchema } from "@/server/routers/hotels/output"
import type {
citiesByCountrySchema,
countriesSchema,
locationsSchema,
} from "@/server/routers/hotels/output"
export interface LocationSchema extends z.output<typeof apiLocationsSchema> {}
export interface LocationSchema extends z.output<typeof locationsSchema> { }
export type Locations = LocationSchema["data"]
export type Location = Locations[number]
@@ -15,3 +19,8 @@ export function isHotelLocation(
): location is HotelLocation {
return location?.type === "hotels"
}
export interface CitiesByCountry
extends z.output<typeof citiesByCountrySchema> { }
export type CitiesGroupedByCountry = Record<string, CitiesByCountry["data"]>
export interface Countries extends z.output<typeof countriesSchema> { }

View File

@@ -0,0 +1,5 @@
import type { z } from "zod"
import type { rateSchema } from "@/server/routers/hotels/schemas/rate"
export type Rate = z.output<typeof rateSchema>

View File

@@ -0,0 +1,16 @@
import type { z } from "zod"
import type { RouterOutput } from "@/lib/trpc/client"
import type { roomsAvailabilitySchema } from "@/server/routers/hotels/output"
import type { roomConfigurationSchema } from "@/server/routers/hotels/schemas/roomAvailability/configuration"
import type { productSchema } from "@/server/routers/hotels/schemas/roomAvailability/product"
import type { rateDefinitionSchema } from "@/server/routers/hotels/schemas/roomAvailability/rateDefinition"
export type RoomAvailability = NonNullable<
RouterOutput["hotel"]["availability"]["room"]
>
export type Product = z.output<typeof productSchema>
export type RateDefinition = z.output<typeof rateDefinitionSchema>
export type RoomConfiguration = z.output<typeof roomConfigurationSchema>
export type RoomsAvailability = z.output<typeof roomsAvailabilitySchema>