(userId?: string)
| 2 | import { prisma } from "@/lib/utils/db"; |
| 3 | |
| 4 | export async function getUserGitHubToken(userId?: string): Promise<string | null> { |
| 5 | if (!userId) { |
| 6 | return null; |
| 7 | } |
| 8 | |
| 9 | try { |
| 10 | const account = await prisma.account.findFirst({ |
| 11 | where: { |
| 12 | userId, |
| 13 | providerId: "github", |
| 14 | }, |
| 15 | select: { |
| 16 | accessToken: true, |
| 17 | }, |
| 18 | }); |
| 19 | |
| 20 | return account?.accessToken || null; |
| 21 | } catch { |
| 22 | return null; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | export async function getSessionUserToken(request?: Request): Promise<string | null> { |
| 27 | try { |
no outgoing calls
no test coverage detected