Merged in fix/SW-3199-prod-users-are-displayed-with- (pull request #2592)
fix(SW-3199): Fixed redemption search for alternative hotels * fix(SW-3199): Fixed redemption search for alternative hotels * fix(SW-3199): User points validation included Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -136,12 +136,40 @@ export const hotelQueryRouter = router({
|
||||
env.CACHE_TIME_CITY_SEARCH
|
||||
)
|
||||
}),
|
||||
hotelsByHotelIds: serviceProcedure
|
||||
hotelsByHotelIds: safeProtectedServiceProcedure
|
||||
.input(getHotelsByHotelIdsAvailabilityInputSchema)
|
||||
.use(async ({ ctx, input, next }) => {
|
||||
if (input.redemption) {
|
||||
if (ctx.session?.token.access_token) {
|
||||
const verifiedUser = await getVerifiedUser({ session: ctx.session })
|
||||
if (!verifiedUser?.error) {
|
||||
return next({
|
||||
ctx: {
|
||||
token: ctx.session.token.access_token,
|
||||
userPoints: verifiedUser?.data.membership?.currentPoints ?? 0,
|
||||
},
|
||||
input,
|
||||
})
|
||||
}
|
||||
}
|
||||
throw unauthorizedError()
|
||||
}
|
||||
return next({
|
||||
ctx: {
|
||||
token: ctx.serviceToken,
|
||||
},
|
||||
input,
|
||||
})
|
||||
})
|
||||
.query(async ({ input, ctx }) => {
|
||||
const { lang } = ctx
|
||||
const apiLang = toApiLang(lang)
|
||||
return getHotelsAvailabilityByHotelIds(input, apiLang, ctx.serviceToken)
|
||||
return getHotelsAvailabilityByHotelIds(
|
||||
input,
|
||||
apiLang,
|
||||
ctx.token,
|
||||
ctx.userPoints
|
||||
)
|
||||
}),
|
||||
|
||||
enterDetails: safeProtectedServiceProcedure
|
||||
|
||||
Reference in New Issue
Block a user