Merged in chore(LOY-531)-cleanup-old-stays (pull request #3498)
chore(LOY-531): cleanup old stays * chore(LOY-531): cleanup old stays Approved-by: Emma Zettervall Approved-by: Anton Gunnarsson
This commit is contained in:
8
packages/trpc/env/server.ts
vendored
8
packages/trpc/env/server.ts
vendored
@@ -36,13 +36,6 @@ export const env = createEnv({
|
||||
SENTRY_ENVIRONMENT: z.string().default("development"),
|
||||
PUBLIC_URL: z.string().default(""),
|
||||
SALESFORCE_PREFERENCE_BASE_URL: z.string(),
|
||||
NEW_STAYS_ON_MY_PAGES: z
|
||||
.string()
|
||||
// only allow "true" or "false"
|
||||
.refine((s) => s === "true" || s === "false")
|
||||
// transform to boolean
|
||||
.transform((s) => s === "true")
|
||||
.default("false"),
|
||||
},
|
||||
emptyStringAsUndefined: true,
|
||||
runtimeEnv: {
|
||||
@@ -63,6 +56,5 @@ export const env = createEnv({
|
||||
SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT,
|
||||
PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL,
|
||||
SALESFORCE_PREFERENCE_BASE_URL: process.env.SALESFORCE_PREFERENCE_BASE_URL,
|
||||
NEW_STAYS_ON_MY_PAGES: process.env.NEW_STAYS_ON_MY_PAGES,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -2,7 +2,6 @@ import { BALFWD } from "@scandic-hotels/common/constants/transactionType"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
|
||||
|
||||
import { env } from "../../../../env/server"
|
||||
import { router } from "../../.."
|
||||
import * as api from "../../../api"
|
||||
import { Transactions } from "../../../enums/transactions"
|
||||
@@ -186,30 +185,23 @@ export const userQueryRouter = router({
|
||||
language
|
||||
)
|
||||
|
||||
if (env.NEW_STAYS_ON_MY_PAGES) {
|
||||
// When includeFirstStay is true (used by SidePeek), return all stays
|
||||
if (includeFirstStay) {
|
||||
return {
|
||||
data: updatedData,
|
||||
nextCursor,
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedData.length <= 1) {
|
||||
// If there are 1 or fewer stays, return null since NextStay handles this
|
||||
return null
|
||||
}
|
||||
|
||||
// If there are multiple stays, filter out the first one since NextStay shows it
|
||||
const filteredData = updatedData.slice(1)
|
||||
// When includeFirstStay is true (used by SidePeek), return all stays
|
||||
if (includeFirstStay) {
|
||||
return {
|
||||
data: filteredData,
|
||||
data: updatedData,
|
||||
nextCursor,
|
||||
}
|
||||
}
|
||||
|
||||
if (updatedData.length <= 1) {
|
||||
// If there are 1 or fewer stays, return null since NextStay handles this
|
||||
return null
|
||||
}
|
||||
|
||||
// If there are multiple stays, filter out the first one since NextStay shows it
|
||||
const filteredData = updatedData.slice(1)
|
||||
return {
|
||||
data: updatedData,
|
||||
data: filteredData,
|
||||
nextCursor,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user