gradido/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts
einhornimmond 987582c3ef Revert "use root biome config for backend, add useImportType rule"
This reverts commit bb8132791557fb9dcbf117ff7c3622a83e2e3730.
2025-04-30 09:29:09 +02:00

22 lines
830 B
TypeScript

import { User as DbUser } from '@entity/User'
import { verifyAuthToken } from '@/apis/gms/GmsClient'
import { CONFIG } from '@/config'
import { GmsUserAuthenticationResult } from '@/graphql/model/GmsUserAuthenticationResult'
import { backendLogger as logger } from '@/server/logger'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
export async function authenticateGmsUserPlayground(
_apiKey: string,
token: string,
dbUser: DbUser,
): Promise<GmsUserAuthenticationResult> {
const result = new GmsUserAuthenticationResult()
const dashboardUrl = ensureUrlEndsWithSlash(CONFIG.GMS_DASHBOARD_URL)
result.url = dashboardUrl.concat(CONFIG.GMS_USER_SEARCH_FRONTEND_ROUTE)
result.token = await verifyAuthToken(dbUser.communityUuid, token)
logger.info('GmsUserAuthenticationResult:', result)
return result
}