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:
Matilda Landström
2026-01-28 07:45:05 +00:00
parent 5fc93472f4
commit 22b0f71c16
12 changed files with 16 additions and 351 deletions

View File

@@ -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,
}
}