Merged in fix/make-user-loyalty-optional (pull request #2044)

fix: Make loyalty optional on user

* Optional user loyalty

* merge


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-05-12 09:00:11 +00:00
committed by Joakim Jäderberg
parent cbbde963dc
commit 60af31762b
12 changed files with 32 additions and 18 deletions

View File

@@ -105,7 +105,11 @@ export const userQueryRouter = router({
}),
membershipLevel: protectedProcedure.query(async function ({ ctx }) {
const verifiedData = await getVerifiedUser({ session: ctx.session })
if (!verifiedData || "error" in verifiedData) {
if (
!verifiedData ||
"error" in verifiedData ||
!verifiedData.data.loyalty
) {
return null
}
@@ -118,7 +122,11 @@ export const userQueryRouter = router({
}
const verifiedData = await getVerifiedUser({ session: ctx.session })
if (!verifiedData || "error" in verifiedData) {
if (
!verifiedData ||
"error" in verifiedData ||
!verifiedData.data.loyalty
) {
return null
}
@@ -151,7 +159,11 @@ export const userQueryRouter = router({
try {
const verifiedUserData = await getVerifiedUser({ session: ctx.session })
if (!verifiedUserData || "error" in verifiedUserData) {
if (
!verifiedUserData ||
"error" in verifiedUserData ||
!verifiedUserData.data.loyalty
) {
metricsUserTrackingInfo.success({
reason: "invalid user data",
data: notLoggedInUserTrackingData,
@@ -395,7 +407,7 @@ export const userQueryRouter = router({
membershipCards: protectedProcedure.query(async function ({ ctx }) {
const userData = await getVerifiedUser({ session: ctx.session })
if (!userData || "error" in userData) {
if (!userData || "error" in userData || !userData.data.loyalty) {
return null
}