Test 2 reoslutions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user