MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getUserAccount

Function getUserAccount

packages/db/src/services/user.service.ts:13–44  ·  view source on GitHub ↗
({
  email,
  provider,
  providerId,
}: { email: string; provider: string; providerId?: string })

Source from the content-addressed store, hash-verified

11}
12
13export async function getUserAccount({
14 email,
15 provider,
16 providerId,
17}: { email: string; provider: string; providerId?: string }) {
18 const res = await db.user.findFirst({
19 where: {
20 email: {
21 equals: email,
22 mode: 'insensitive',
23 },
24 },
25 include: {
26 accounts: {
27 where: {
28 provider,
29 providerId: providerId ? String(providerId) : undefined,
30 },
31 take: 1,
32 },
33 },
34 });
35
36 if (!res?.accounts[0]) {
37 return null;
38 }
39
40 return {
41 ...res,
42 account: res?.accounts[0],
43 };
44}

Callers 1

auth.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected