feat(SW-160): update profile
This commit is contained in:
committed by
Michael Zetterberg
parent
b6e22d51a5
commit
2337d37f1a
@@ -20,16 +20,16 @@ import tempRatesData from "./tempRatesData.json"
|
||||
export const hotelQueryRouter = router({
|
||||
getHotel: serviceProcedure
|
||||
.input(getHotelInputSchema)
|
||||
.query(async ({ input, ctx }) => {
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { hotelId, language, include } = input
|
||||
|
||||
const params = new URLSearchParams()
|
||||
|
||||
const apiLang = toApiLang(language)
|
||||
params.set("language", apiLang)
|
||||
|
||||
const params: Record<string, string> = {
|
||||
hotelId,
|
||||
language: apiLang,
|
||||
}
|
||||
if (include) {
|
||||
params.set("include", include.join(","))
|
||||
params.include = include.join(",")
|
||||
}
|
||||
|
||||
const apiResponse = await api.get(
|
||||
@@ -61,16 +61,16 @@ export const hotelQueryRouter = router({
|
||||
|
||||
const roomCategories = included
|
||||
? included
|
||||
.filter((item) => item.type === "roomcategories")
|
||||
.map((roomCategory) => {
|
||||
const validatedRoom = roomSchema.safeParse(roomCategory)
|
||||
if (!validatedRoom.success) {
|
||||
console.error(`Get Room Category Data - Verified Data Error`)
|
||||
console.error(validatedRoom.error)
|
||||
throw badRequestError()
|
||||
}
|
||||
return validatedRoom.data
|
||||
})
|
||||
.filter((item) => item.type === "roomcategories")
|
||||
.map((roomCategory) => {
|
||||
const validatedRoom = roomSchema.safeParse(roomCategory)
|
||||
if (!validatedRoom.success) {
|
||||
console.error(`Get Room Category Data - Verified Data Error`)
|
||||
console.error(validatedRoom.error)
|
||||
throw badRequestError()
|
||||
}
|
||||
return validatedRoom.data
|
||||
})
|
||||
: []
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user