Merged in feat/warmup-cache-function (pull request #1581)
Feat/warmup cache function * WIP * Fix warmup for all languages * Cleanup * Added env flag so we can disable warmup * Changed time to 04.00 UTC since backend updates their data at 03.00 UTC * Add return statements * Merge branch 'master' into feat/warmup-cache-function Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -92,6 +92,12 @@ export const nearbyHotelIdsInput = z.object({
|
||||
hotelId: z.string(),
|
||||
})
|
||||
|
||||
export const getAllHotelsInput = z
|
||||
.object({
|
||||
lang: z.nativeEnum(Lang),
|
||||
})
|
||||
.optional()
|
||||
|
||||
export const breakfastPackageInputSchema = z.object({
|
||||
adults: z.number().min(1, { message: "at least one adult is required" }),
|
||||
fromDate: z
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
breakfastPackageInputSchema,
|
||||
cityCoordinatesInputSchema,
|
||||
getAdditionalDataInputSchema,
|
||||
getAllHotelsInput,
|
||||
getHotelsByCityIdentifierInput,
|
||||
getHotelsByCountryInput,
|
||||
getHotelsByCSFilterInput,
|
||||
@@ -1144,14 +1145,18 @@ export const hotelQueryRouter = router({
|
||||
}),
|
||||
}),
|
||||
getAllHotels: router({
|
||||
get: serviceProcedure.query(async function ({ ctx }) {
|
||||
get: serviceProcedure.input(getAllHotelsInput).query(async function ({
|
||||
input,
|
||||
ctx,
|
||||
}) {
|
||||
const lang = input?.lang ?? ctx.lang
|
||||
const countries = await getCountries({
|
||||
lang: ctx.lang,
|
||||
lang: lang,
|
||||
serviceToken: ctx.serviceToken,
|
||||
})
|
||||
|
||||
if (!countries) {
|
||||
return null
|
||||
throw new Error("Unable to fetch countries")
|
||||
}
|
||||
|
||||
const countryNames = countries.data.map((country) => country.name)
|
||||
@@ -1165,7 +1170,7 @@ export const hotelQueryRouter = router({
|
||||
|
||||
const hotels = await getHotelsByHotelIds({
|
||||
hotelIds,
|
||||
lang: ctx.lang,
|
||||
lang: lang,
|
||||
serviceToken: ctx.serviceToken,
|
||||
})
|
||||
return hotels
|
||||
|
||||
Reference in New Issue
Block a user