* Get a credential by resolved account ID and verify it belongs to the user.
(requestId: string, accountId: string, userId: string)
| 296 | * Get a credential by resolved account ID and verify it belongs to the user. |
| 297 | */ |
| 298 | async function getCredentialByAccountId(requestId: string, accountId: string, userId: string) { |
| 299 | const credentials = await db |
| 300 | .select() |
| 301 | .from(account) |
| 302 | .where(and(eq(account.id, accountId), eq(account.userId, userId))) |
| 303 | .limit(1) |
| 304 | |
| 305 | if (!credentials.length) { |
| 306 | logger.warn(`[${requestId}] Credential not found`) |
| 307 | return undefined |
| 308 | } |
| 309 | |
| 310 | return { |
| 311 | ...credentials[0], |
| 312 | resolvedCredentialId: accountId, |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Get a credential by ID and verify it belongs to the user. |
no test coverage detected