diff --git a/apps/web/src/app/admin/scanner/[id]/page.tsx b/apps/web/src/app/admin/scanner/[id]/page.tsx index c3f3d2dd..13a9641a 100644 --- a/apps/web/src/app/admin/scanner/[id]/page.tsx +++ b/apps/web/src/app/admin/scanner/[id]/page.tsx @@ -36,55 +36,55 @@ export default async function Page({ } if (!searchParams.user) { - return ( -
- -
- ); - } - - const [scan, scanUser] = await db.transaction(async (tx) => { - const scanUser = await tx.query.userCommonData.findFirst({ - where: eq(userCommonData.clerkID, searchParams.user!), - with: { - hackerData: { - with: { - team: true, - }, - }, - }, - }); - if (!scanUser) { - return [null, null]; - } - const scan = await tx.query.scans.findFirst({ - where: and( - eq(scans.eventID, event.id), - eq(scans.userID, scanUser.clerkID), - ), - }); - if (scan) { - return [scan, scanUser]; - } else { - return [null, scanUser]; - } - }); + return ( +
+ +
+ ); + } - return ( -
- -
- ); + const [scan, scanUser] = await db.transaction(async (tx) => { + const scanUser = await tx.query.userCommonData.findFirst({ + where: eq(userCommonData.clerkID, searchParams.user!), + with: { + hackerData: { + with: { + team: true, + }, + }, + }, + }); + if (!scanUser) { + return [null, null]; + } + const scan = await tx.query.scans.findFirst({ + where: and( + eq(scans.eventID, event.id), + eq(scans.userID, scanUser.clerkID), + ), + }); + if (scan) { + return [scan, scanUser]; + } else { + return [null, scanUser]; + } + }); + + return ( +
+ +
+ ); } export const runtime = "edge"; diff --git a/apps/web/src/app/api/admin/export/route.ts b/apps/web/src/app/api/admin/export/route.ts index c4847412..72fe0072 100644 --- a/apps/web/src/app/api/admin/export/route.ts +++ b/apps/web/src/app/api/admin/export/route.ts @@ -58,7 +58,7 @@ export async function GET() { ...user, ...user.hackerData, }; - delete toRet.hackerData; + delete toRet.hackerData; return toRet; }); diff --git a/apps/web/src/app/api/team/create/route.ts b/apps/web/src/app/api/team/create/route.ts index 5e50d2e3..2574fc89 100644 --- a/apps/web/src/app/api/team/create/route.ts +++ b/apps/web/src/app/api/team/create/route.ts @@ -49,7 +49,7 @@ export async function POST(req: Request) { }); await tx .update(userHackerData) - .set({teamID}) + .set({ teamID }) .where(eq(userHackerData.clerkID, userId)); }); return NextResponse.json({ diff --git a/apps/web/src/app/api/team/invite/accept/route.ts b/apps/web/src/app/api/team/invite/accept/route.ts index 00b8e6f2..298e23b6 100644 --- a/apps/web/src/app/api/team/invite/accept/route.ts +++ b/apps/web/src/app/api/team/invite/accept/route.ts @@ -82,7 +82,7 @@ export async function POST( .update(userHackerData) .set({ teamID: user.invites[0].teamID }) .where(eq(userHackerData.clerkID, userId)); - + // TODO: would be interesting to see if the and() could be removed here in favor of directly looking up the composite key. await db .update(invites) diff --git a/apps/web/src/components/admin/users/ServerSections.tsx b/apps/web/src/components/admin/users/ServerSections.tsx index 02ccc668..a224c138 100644 --- a/apps/web/src/components/admin/users/ServerSections.tsx +++ b/apps/web/src/components/admin/users/ServerSections.tsx @@ -57,21 +57,23 @@ export function ProfileInfo({ user }: { user: UserWithAllData }) { } export async function AccountInfo({ user }: { user: UserWithAllData }) { - const clerkUser = await clerkClient.users.getUser(user.clerkID).catch(() => {}); + const clerkUser = await clerkClient.users + .getUser(user.clerkID) + .catch(() => {}); return (
- { clerkUser ? - <> - - - - : -
- Failed to find Clerk authentication data. -
- } + {clerkUser ? ( + <> + + + + ) : ( +
+ Failed to find Clerk authentication data. +
+ )}
);