feat(SW-717) Multiple requests if adult differ between rooms

This commit is contained in:
Pontus Dreij
2025-01-24 09:31:28 +01:00
parent c0f5c0278b
commit d5bc2b3c57
9 changed files with 93 additions and 48 deletions

View File

@@ -23,7 +23,7 @@ interface HotelSearchDetails<T> {
city: Location | null
hotel: HotelLocation | null
selectHotelParams: SelectHotelParams<T> & { city: string | undefined }
adultsInRoom: number
adultsInRoom: number[]
childrenInRoomString?: string
childrenInRoom?: Child[]
}
@@ -79,7 +79,7 @@ export async function getHotelSearchDetails<
if (!city && !hotel) return notFound()
if (isAlternativeHotels && (!city || !hotel)) return notFound()
let adultsInRoom = 1
let adultsInRoom: number[] = []
let childrenInRoomString: HotelSearchDetails<T>["childrenInRoomString"] =
undefined
let childrenInRoom: HotelSearchDetails<T>["childrenInRoom"] = undefined
@@ -87,7 +87,7 @@ export async function getHotelSearchDetails<
const { rooms } = selectHotelParams
if (rooms && rooms.length > 0) {
adultsInRoom = rooms[0].adults // TODO: Handle multiple rooms
adultsInRoom = rooms.map((room) => room.adults?.[0] ?? 0)
childrenInRoomString = rooms[0].childrenInRoom
? generateChildrenString(rooms[0].childrenInRoom)
: undefined // TODO: Handle multiple rooms