Test 2 reoslutions

This commit is contained in:
2026-09-20 15:25:53 +02:00
parent d428f6e17c
commit 2d0f2b494a
5 changed files with 205 additions and 13 deletions
@@ -20,6 +20,8 @@ export interface UserSyncProfile {
name?: string | null;
role?: string | null;
tenant?: string | null;
tenant_id?: number | string | null;
organisationId?: number | string | null;
organisationName?: string | null;
}
@@ -199,6 +201,19 @@ async function executeBackendSync(
userSub?: string,
profile?: UserSyncProfile
): Promise<{ endpoint: string; data?: any }> {
const rawTenantId = profile?.tenant_id ?? (profile as any)?.tenantId;
const parsedTenantId =
rawTenantId !== undefined && rawTenantId !== null && rawTenantId !== ''
? Number(rawTenantId)
: undefined;
const resolvedOrgId =
parsedTenantId !== undefined
? parsedTenantId
: profile?.organisationId !== undefined && profile?.organisationId !== null && profile?.organisationId !== ''
? Number(profile.organisationId)
: undefined;
const payload = {
id: userSub || profile?.id || profile?.sub,
sub: userSub || profile?.sub,
@@ -206,6 +221,8 @@ async function executeBackendSync(
name: profile?.name || undefined,
role: profile?.role || undefined,
tenant: profile?.tenant || undefined,
tenant_id: parsedTenantId,
organisationId: resolvedOrgId,
};
const candidateEndpoints = USER_SYNC_CANDIDATE_ENDPOINTS;