fix: clean up hotel and its typings
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
5
types/trpc/routers/hotel/filter.ts
Normal file
5
types/trpc/routers/hotel/filter.ts
Normal 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>
|
||||
12
types/trpc/routers/hotel/hotel.ts
Normal file
12
types/trpc/routers/hotel/hotel.ts
Normal 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">
|
||||
@@ -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> { }
|
||||
|
||||
5
types/trpc/routers/hotel/rate.ts
Normal file
5
types/trpc/routers/hotel/rate.ts
Normal 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>
|
||||
16
types/trpc/routers/hotel/roomAvailability.ts
Normal file
16
types/trpc/routers/hotel/roomAvailability.ts
Normal 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>
|
||||
Reference in New Issue
Block a user