feat(SW-1012): Started implementing restaurant data
This commit is contained in:
committed by
Fredrik Thorsson
parent
05006506f0
commit
63a77b215d
23
utils/getBookedHotelRoom.ts
Normal file
23
utils/getBookedHotelRoom.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { RouterOutput } from "@/lib/trpc/client"
|
||||
|
||||
export function getBookedHotelRoom(
|
||||
hotel: RouterOutput["booking"]["confirmation"]["hotel"],
|
||||
roomTypeCode: string
|
||||
) {
|
||||
const room = hotel.included?.rooms?.find((include) => {
|
||||
return include.roomTypes.find((roomType) => roomType.code === roomTypeCode)
|
||||
})
|
||||
if (!room) {
|
||||
return null
|
||||
}
|
||||
const bedType = room.roomTypes.find(
|
||||
(roomType) => roomType.code === roomTypeCode
|
||||
)
|
||||
if (!bedType) {
|
||||
return null
|
||||
}
|
||||
return {
|
||||
...room,
|
||||
bedType,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user