Merged in feat/SW-2999-cleanup (pull request #2810)

feat(SW-2999): cleanup current web

* feat(SW-2999): cleanup current web

* Merge master

* Removed unused fonts


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-09-16 11:28:57 +00:00
parent 48324ef935
commit fd0198f57b
137 changed files with 5 additions and 146805 deletions

View File

@@ -5,14 +5,6 @@ import { createCounter } from "@scandic-hotels/common/telemetry"
import { router } from "../../.."
import { notFound } from "../../../errors"
import { GetContactConfig } from "../../../graphql/Query/ContactConfig.graphql"
import {
GetCurrentFooter,
GetCurrentFooterRef,
} from "../../../graphql/Query/Current/Footer.graphql"
import {
GetCurrentHeader,
GetCurrentHeaderRef,
} from "../../../graphql/Query/Current/Header.graphql"
import { GetFooter, GetFooterRef } from "../../../graphql/Query/Footer.graphql"
import { GetHeader, GetHeaderRef } from "../../../graphql/Query/Header.graphql"
import {
@@ -31,17 +23,11 @@ import {
} from "../../../utils/generateTag"
import {
type ContactConfigData,
type CurrentFooterDataRaw,
type CurrentFooterRefDataRaw,
type CurrentHeaderRefDataRaw,
type GetCurrentHeaderData,
headerRefsSchema,
headerSchema,
siteConfigRefSchema,
siteConfigSchema,
validateContactConfigSchema,
validateCurrentFooterConfigSchema,
validateCurrentHeaderConfigSchema,
validateFooterConfigSchema,
validateFooterRefConfigSchema,
} from "./output"
@@ -180,139 +166,6 @@ export const baseQueryRouter = router({
data: validatedHeaderConfig.data.header,
}
}),
currentHeader: contentstackBaseProcedure
.input(langInput)
.query(async ({ input }) => {
const getCurrentHeaderRefsCounter = createCounter(
"trpc.contentstack",
"currentHeader.get.refs"
)
const metricsGetCurrentHeaderRefs = getCurrentHeaderRefsCounter.init({
lang: input.lang,
})
metricsGetCurrentHeaderRefs.start()
const responseRef = await request<CurrentHeaderRefDataRaw>(
GetCurrentHeaderRef,
{
locale: input.lang,
},
{
key: generateRefsResponseTag(input.lang, "current_header"),
ttl: "max",
}
)
const getCurrentHeaderCounter = createCounter(
"trpc.contentstack",
"currentHeader.get"
)
const metricsGetCurrentHeader = getCurrentHeaderCounter.init({
lang: input.lang,
})
metricsGetCurrentHeader.start()
const currentHeaderUID =
responseRef.data.all_current_header.items[0].system.uid
// There's currently no error handling/validation for the responseRef, should it be added?
const response = await request<GetCurrentHeaderData>(
GetCurrentHeader,
{ locale: input.lang },
{
key: generateTag(input.lang, currentHeaderUID),
ttl: "max",
}
)
if (!response.data) {
const notFoundError = notFound(response)
metricsGetCurrentHeader.noDataError()
throw notFoundError
}
const validatedHeaderConfig = validateCurrentHeaderConfigSchema.safeParse(
response.data
)
if (!validatedHeaderConfig.success) {
metricsGetCurrentHeader.validationError(validatedHeaderConfig.error)
return null
}
metricsGetCurrentHeader.success()
return validatedHeaderConfig.data
}),
currentFooter: contentstackBaseProcedure
.input(langInput)
.query(async ({ input }) => {
const getCurrentFooterRefsCounter = createCounter(
"trpc.contentstack",
"currentFooter.get.refs"
)
const metricsGetCurrentFooterRefs = getCurrentFooterRefsCounter.init({
lang: input.lang,
})
metricsGetCurrentFooterRefs.start()
const responseRef = await request<CurrentFooterRefDataRaw>(
GetCurrentFooterRef,
{
locale: input.lang,
},
{
key: generateRefsResponseTag(input.lang, "current_footer"),
ttl: "max",
}
)
const getCurrentFooterCounter = createCounter(
"trpc.contentstack",
"currentFooter.get"
)
const metricsGetCurrentFooter = getCurrentFooterCounter.init({
lang: input.lang,
})
metricsGetCurrentFooter.start()
const currentFooterUID =
responseRef.data.all_current_footer.items[0].system.uid
const response = await request<CurrentFooterDataRaw>(
GetCurrentFooter,
{
locale: input.lang,
},
{
key: generateTag(input.lang, currentFooterUID),
ttl: "max",
}
)
if (!response.data) {
const notFoundError = notFound(response)
metricsGetCurrentFooter.noDataError()
throw notFoundError
}
const validatedCurrentFooterConfig =
validateCurrentFooterConfigSchema.safeParse(response.data)
if (!validatedCurrentFooterConfig.success) {
metricsGetCurrentFooter.validationError(
validatedCurrentFooterConfig.error
)
return null
}
metricsGetCurrentFooter.success()
return validatedCurrentFooterConfig.data.all_current_footer.items[0]
}),
footer: contentstackBaseProcedure.query(async ({ ctx }) => {
const { lang } = ctx