Merged in fix/add-missing-partner-data (pull request #3116)

fix: Add param to getScandicUser for extended data

* Add param to getScandicUser for extended data


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-11-10 15:23:07 +00:00
parent ce3412b29f
commit 0b569e28ce
4 changed files with 8 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ export async function createAppContext() {
return euroBonusProfile.points.total
},
getScandicUser: async () => {
getScandicUser: async (input) => {
const session = await getSocialSession()
if (!session) return null
@@ -54,6 +54,7 @@ export async function createAppContext() {
expires_at: dt(session.expires_at).unix() * 1000,
access_token: session.access_token,
},
includeExtendedPartnerData: input?.withExtendedPartnerData,
})
return user ?? null

View File

@@ -73,7 +73,7 @@ export async function createAppContext() {
return user.membership?.currentPoints ?? 0
},
getScandicUser: async () => {
getScandicUser: async (input) => {
const session = await getUserSession()
if (!session) return null
@@ -82,6 +82,7 @@ export async function createAppContext() {
expires_at: session.token.expires_at ?? 0,
access_token: session.token.access_token,
},
includeExtendedPartnerData: input?.withExtendedPartnerData,
})
return user ?? null

View File

@@ -23,7 +23,9 @@ type CreateContextOptions = {
app: "scandic-web" | "partner-sas"
getScandicUserToken: () => Promise<string | null>
getUserPointsBalance: () => Promise<number | null>
getScandicUser: () => Promise<ScandicUser | null>
getScandicUser: (input?: {
withExtendedPartnerData: boolean
}) => Promise<ScandicUser | null>
}
export function createContext(opts: CreateContextOptions) {

View File

@@ -70,7 +70,7 @@ export const userQueryRouter = router({
return null
}
const user = await ctx.getScandicUser()
const user = await ctx.getScandicUser({ withExtendedPartnerData: true })
if (!user) {
return null