feat: add new auth_request flow for logging in with comfy deploy

This commit is contained in:
BennyKok
2024-01-22 14:11:14 +08:00
parent 3043093d22
commit 47168930dc
25 changed files with 2424 additions and 272 deletions
@@ -0,0 +1,18 @@
import { db } from "@/db/db";
import { usersTable } from "@/db/schema";
import { clerkClient } from "@clerk/nextjs";
import { eq } from "drizzle-orm";
export async function getOrgOrUserDisplayName(
orgId: string | undefined | null,
userId: string,
) {
return orgId
? await clerkClient.organizations
.getOrganization({
organizationId: orgId,
})
.then((x) => x.name)
: (await db.select().from(usersTable).where(eq(usersTable.id, userId)))[0]
.name;
}