Feat/SW-3287 campaign start end

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-08-22 09:18:52 +00:00
parent ce3b7a6a49
commit c7c55bd7b1
2 changed files with 31 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
import { dt } from "@scandic-hotels/common/dt"
import { createCounter } from "@scandic-hotels/common/telemetry"
import { notFound } from "../../../errors"
@@ -103,6 +104,7 @@ export async function getCampaignPagesByHotelPageUid(
hotelPageUid: string,
lang: Lang
) {
const today = dt().format("YYYY-MM-DD")
const getCampaignPagesByHotelUidRefsCounter = createCounter(
"trpc.contentstack",
"campaignPage.byHotelUid.get.refs"
@@ -111,6 +113,7 @@ export async function getCampaignPagesByHotelPageUid(
getCampaignPagesByHotelUidRefsCounter.init({
lang,
hotelPageUid,
today,
})
metricsGetCampaignPagesByHotelUidRefs.start()
@@ -120,9 +123,14 @@ export async function getCampaignPagesByHotelPageUid(
{
locale: lang,
hotelPageUid,
today,
},
{
key: generateRefsResponseTag(lang, hotelPageUid, "hotel_page_campaigns"),
key: generateRefsResponseTag(
lang,
`${hotelPageUid}-${today}`,
"hotel_page_campaigns"
),
ttl: "max",
}
)
@@ -155,6 +163,7 @@ export async function getCampaignPagesByHotelPageUid(
getCampaignPagesByHotelUidCounter.init({
lang,
hotelPageUid,
today,
})
metricsGetCampaignPagesByHotelUid.start()
@@ -164,6 +173,7 @@ export async function getCampaignPagesByHotelPageUid(
{
locale: lang,
hotelPageUid,
today,
},
{
key: tags,