From 7e19922b4fb841fab4da546f10275d89a92e4009 Mon Sep 17 00:00:00 2001 From: ryanMathram <168239412+ryanMathram@users.noreply.github.com> Date: Thu, 17 Jul 2025 00:26:08 -0500 Subject: [PATCH 1/6] Clearing out admin "coming soon" and some of the unused config variables --- apps/web/src/app/admin/toggles/layout.tsx | 7 ++++--- packages/config/hackkit.config.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/web/src/app/admin/toggles/layout.tsx b/apps/web/src/app/admin/toggles/layout.tsx index b56bb32d..51174ae3 100644 --- a/apps/web/src/app/admin/toggles/layout.tsx +++ b/apps/web/src/app/admin/toggles/layout.tsx @@ -4,21 +4,22 @@ interface ToggleLayoutProps { children: React.ReactNode; } + export default function Layout({ children }: ToggleLayoutProps) { return (
- + {/**/} - + />*/}
{children}
diff --git a/packages/config/hackkit.config.ts b/packages/config/hackkit.config.ts index e3a37bd8..7f6c2cc5 100644 --- a/packages/config/hackkit.config.ts +++ b/packages/config/hackkit.config.ts @@ -912,9 +912,9 @@ const c = { Overview: "/admin", Users: "/admin/users", Events: "/admin/events", - Points: "/admin/points", + //Points: "/admin/points", "Hackathon Check-in": "/admin/check-in", - Toggles: "/admin/toggles", + //Toggles: "/admin/toggles", }, // TODO: Can remove days? Pretty sure they're dynamic now. }, From 2f88283f07b39727f31fac469d0192f80dda00ba Mon Sep 17 00:00:00 2001 From: ryanMathram <168239412+ryanMathram@users.noreply.github.com> Date: Thu, 17 Jul 2025 16:18:15 -0500 Subject: [PATCH 2/6] Cleared out Secret Registeration sections --- apps/web/src/actions/admin/registration-actions.ts | 4 ++-- .../src/app/admin/toggles/registration/page.tsx | 8 ++++---- apps/web/src/app/register/page.tsx | 4 ++-- apps/web/src/app/sign-up/[[...sign-up]]/page.tsx | 4 ++-- .../admin/toggles/RegistrationSettings.tsx | 14 +++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/web/src/actions/admin/registration-actions.ts b/apps/web/src/actions/admin/registration-actions.ts index 1d069199..abd0a239 100644 --- a/apps/web/src/actions/admin/registration-actions.ts +++ b/apps/web/src/actions/admin/registration-actions.ts @@ -32,7 +32,7 @@ export const toggleRegistrationMessageEnabled = adminAction return { success: true, statusSet: enabled }; }); -export const toggleSecretRegistrationEnabled = adminAction +/*export const toggleSecretRegistrationEnabled = adminAction .schema(defaultRegistrationToggleSchema) .action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => { await redisSet( @@ -41,7 +41,7 @@ export const toggleSecretRegistrationEnabled = adminAction ); revalidatePath("/admin/toggles/registration"); return { success: true, statusSet: enabled }; - }); + });*/ export const toggleRSVPs = adminAction .schema(defaultRegistrationToggleSchema) diff --git a/apps/web/src/app/admin/toggles/registration/page.tsx b/apps/web/src/app/admin/toggles/registration/page.tsx index 841fe64d..78290a4c 100644 --- a/apps/web/src/app/admin/toggles/registration/page.tsx +++ b/apps/web/src/app/admin/toggles/registration/page.tsx @@ -6,12 +6,12 @@ import c from "config"; export default async function Page() { const [ defaultRegistrationEnabled, - defaultSecretRegistrationEnabled, + //defaultSecretRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit, ]: (string | null)[] = await redisMGet( "config:registration:registrationEnabled", - "config:registration:secretRegistrationEnabled", + //"config:registration:secretRegistrationEnabled", "config:registration:allowRSVPs", "config:registration:maxRSVPs", ); @@ -28,10 +28,10 @@ export default async function Page() { defaultRegistrationEnabled, true, )} - defaultSecretRegistrationEnabled={parseRedisBoolean( + /*defaultSecretRegistrationEnabled={parseRedisBoolean( defaultSecretRegistrationEnabled, false, - )} + )}*/ defaultRSVPsEnabled={parseRedisBoolean( defaultRSVPsEnabled, true, diff --git a/apps/web/src/app/register/page.tsx b/apps/web/src/app/register/page.tsx index 686b872b..79c3ae25 100644 --- a/apps/web/src/app/register/page.tsx +++ b/apps/web/src/app/register/page.tsx @@ -19,12 +19,12 @@ export default async function Page() { const registration = await getUser(userId); if (registration) return redirect("/dash"); - const [defaultRegistrationEnabled, defaultSecretRegistrationEnabled]: ( + const [defaultRegistrationEnabled, /*defaultSecretRegistrationEnabled*/]: ( | string | null )[] = await redisMGet( "config:registration:registrationEnabled", - "config:registration:secretRegistrationEnabled", + //"config:registration:secretRegistrationEnabled", ); if (parseRedisBoolean(defaultRegistrationEnabled, true) === true) { diff --git a/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx b/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx index ecd4c49f..6fe0cd76 100644 --- a/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx +++ b/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx @@ -6,12 +6,12 @@ import { Button } from "@/components/shadcn/ui/button"; import Link from "next/link"; export default async function Page() { - const [defaultRegistrationEnabled, defaultSecretRegistrationEnabled]: ( + const [defaultRegistrationEnabled, /*defaultSecretRegistrationEnabled*/]: ( | string | null )[] = await redisMGet( "config:registration:registrationEnabled", - "config:registration:secretRegistrationEnabled", + //"config:registration:secretRegistrationEnabled", ); if (parseRedisBoolean(defaultRegistrationEnabled, true) === true) { diff --git a/apps/web/src/components/admin/toggles/RegistrationSettings.tsx b/apps/web/src/components/admin/toggles/RegistrationSettings.tsx index 0b415fd6..093feb85 100644 --- a/apps/web/src/components/admin/toggles/RegistrationSettings.tsx +++ b/apps/web/src/components/admin/toggles/RegistrationSettings.tsx @@ -9,7 +9,7 @@ import { toast } from "sonner"; import { toggleRegistrationEnabled, toggleRegistrationMessageEnabled, - toggleSecretRegistrationEnabled, + //toggleSecretRegistrationEnabled, toggleRSVPs, setRSVPLimit, } from "@/actions/admin/registration-actions"; @@ -17,18 +17,18 @@ import { UpdateItemWithConfirmation } from "./UpdateItemWithConfirmation"; interface RegistrationTogglesProps { defaultRegistrationEnabled: boolean; - defaultSecretRegistrationEnabled: boolean; + //defaultSecretRegistrationEnabled: boolean; defaultRSVPsEnabled: boolean; defaultRSVPLimit: number; } export function RegistrationToggles({ - defaultSecretRegistrationEnabled, + //defaultSecretRegistrationEnabled, defaultRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit, }: RegistrationTogglesProps) { - const { + /*const { execute: executeToggleSecretRegistrationEnabled, optimisticState: ToggleSecretRegistrationEnabledOptimisticData, } = useOptimisticAction(toggleSecretRegistrationEnabled, { @@ -39,7 +39,7 @@ export function RegistrationToggles({ updateFn: (state, { enabled }) => { return { statusSet: enabled, success: true }; }, - }); + });*/ const { execute: executeToggleRSVPs, @@ -93,7 +93,7 @@ export function RegistrationToggles({ }} /> -
+ {/*

Allow Secret Code Sign-up

@@ -111,7 +111,7 @@ export function RegistrationToggles({ }); }} /> -
+
*/}
From 94edf755c9ea07281e38bd5fd845bcc6de79303b Mon Sep 17 00:00:00 2001 From: ryanMathram <168239412+ryanMathram@users.noreply.github.com> Date: Thu, 24 Jul 2025 00:13:12 -0500 Subject: [PATCH 3/6] Commented out all code that related to teams and invites --- apps/bot/bot.ts | 2 +- apps/infrastructure-migrator/driver.ts | 18 ++++++------ apps/infrastructure-migrator/schema.ts | 28 +++++++++---------- apps/web/src/actions/teams.ts | 4 +-- apps/web/src/app/admin/scanner/[id]/page.tsx | 2 +- apps/web/src/app/admin/users/[slug]/page.tsx | 6 ++-- apps/web/src/app/api/team/create/route.ts | 4 +-- .../src/app/api/team/invite/accept/route.ts | 4 +-- .../src/app/api/team/invite/create/route.ts | 4 +-- .../src/app/api/team/invite/decline/route.ts | 4 +-- apps/web/src/app/dash/pass/page.tsx | 2 +- apps/web/src/app/dash/team/new/page.tsx | 4 +-- apps/web/src/app/dash/team/page.tsx | 14 +++++----- apps/web/src/app/team/[tag]/page.tsx | 4 +-- apps/web/src/app/user/[tag]/page.tsx | 2 +- .../components/admin/users/ServerSections.tsx | 8 +++--- .../src/components/dash/main/team/NewTeam.tsx | 4 +-- .../components/dash/team/LeaveTeamButton.tsx | 4 +-- apps/web/src/components/dash/team/invite.tsx | 4 +-- .../components/dash/team/inviteListing.tsx | 4 +-- .../web/src/validators/shared/registration.ts | 4 +-- apps/web/src/validators/shared/team.ts | 4 +-- packages/config/hackkit.config.ts | 2 +- .../drizzle/0000_chilly_lady_mastermind.sql | 12 ++++---- packages/db/functions/hacker.ts | 8 +++--- packages/db/schema.ts | 12 ++++---- packages/db/types.ts | 7 +++-- 27 files changed, 88 insertions(+), 87 deletions(-) diff --git a/apps/bot/bot.ts b/apps/bot/bot.ts index 92140193..78c83dcf 100644 --- a/apps/bot/bot.ts +++ b/apps/bot/bot.ts @@ -200,7 +200,7 @@ app.post("/api/checkDiscordVerification", async (h) => { } console.log("got here 2"); - const user = await getHacker(verification.clerkID, false); + const user = await getHacker(verification.clerkID/*, false*/); console.log("got here 2 with user", user); if (!user) { console.log("failed cause of no user in db"); diff --git a/apps/infrastructure-migrator/driver.ts b/apps/infrastructure-migrator/driver.ts index ffbab1e7..7a5042b6 100644 --- a/apps/infrastructure-migrator/driver.ts +++ b/apps/infrastructure-migrator/driver.ts @@ -30,8 +30,8 @@ const allUserHackerDataPromise = dbPostgres.query.userHackerData.findMany(); const allEventsPromise = dbPostgres.query.events.findMany(); const allFilesPromise = dbPostgres.query.files.findMany(); const allScansPromise = dbPostgres.query.scans.findMany(); -const allTeamsPromise = dbPostgres.query.teams.findMany(); -const allInvitesPromise = dbPostgres.query.invites.findMany(); +//const allTeamsPromise = dbPostgres.query.teams.findMany(); +//const allInvitesPromise = dbPostgres.query.invites.findMany(); const allErrorLogsPromise = dbPostgres.query.errorLog.findMany(); const alldiscordVerificationPromise = dbPostgres.query.discordVerification.findMany(); @@ -56,8 +56,8 @@ async function migratePostgresSqLite() { allEvents, allFiles, allScans, - allTeams, - allInvites, + //allTeams, + //allInvites, allErrorLogs, alldiscordVerification, allTickets, @@ -71,8 +71,8 @@ async function migratePostgresSqLite() { allEventsPromise, allFilesPromise, allScansPromise, - allTeamsPromise, - allInvitesPromise, + //allTeamsPromise, + //allInvitesPromise, allErrorLogsPromise, alldiscordVerificationPromise, allTicketsPromise, @@ -133,9 +133,9 @@ async function migratePostgresSqLite() { console.log("Migrated Scans ✅\n\n"); - console.log("Migrating Teams 🏆"); + /*console.log("Migrating Teams 🏆"); - if (allTeams.length > 0) { + if (allTeams.length > 0) { await db.insert(schema.teams).values(allTeams); } @@ -147,7 +147,7 @@ async function migratePostgresSqLite() { await db.insert(schema.invites).values(allInvites); } - console.log("Migrated Invites ✅\n\n"); + console.log("Migrated Invites ✅\n\n");*/ console.log("Migrating Error Logs 📝"); diff --git a/apps/infrastructure-migrator/schema.ts b/apps/infrastructure-migrator/schema.ts index c326c277..94ce1438 100644 --- a/apps/infrastructure-migrator/schema.ts +++ b/apps/infrastructure-migrator/schema.ts @@ -132,7 +132,7 @@ export const userHackerData = pgTable("user_hacker_data", { // metadata group: integer("group").notNull(), - teamID: varchar("team_id", { length: 50 }), + //teamID: varchar("team_id", { length: 50 }), points: integer("points").notNull().default(0), hasAcceptedMLHCoC: boolean("has_accepted_mlh_coc").notNull(), hasSharedDataWithMLH: boolean("has_shared_data_with_mlh").notNull(), @@ -146,11 +146,11 @@ export const userHackerRelations = relations( fields: [userHackerData.clerkID], references: [userCommonData.clerkID], }), - team: one(teams, { - fields: [userHackerData.teamID], - references: [teams.id], - }), - invites: many(invites), + //team: one(teams, { + // fields: [userHackerData.teamID], + // references: [teams.id], + //}), + //invites: many(invites), }), ); @@ -211,7 +211,7 @@ export const scansRelations = relations(scans, ({ one }) => ({ }), })); -export const teams = pgTable("teams", { +/*export const teams = pgTable("teams", { id: varchar("id", { length: 50 }).notNull().primaryKey().unique(), name: varchar("name", { length: 255 }).notNull(), tag: varchar("tag", { length: 50 }).notNull().unique(), @@ -220,14 +220,14 @@ export const teams = pgTable("teams", { createdAt: timestamp("created_at").notNull().defaultNow(), ownerID: varchar("owner_id", { length: 255 }).notNull(), devpostURL: varchar("devpost_url", { length: 255 }), -}); +}); */ -export const teamsRelations = relations(teams, ({ one, many }) => ({ +/*export const teamsRelations = relations(teams, ({ one, many }) => ({ members: many(userHackerData), invites: many(invites), -})); +})); */ -export const invites = pgTable( +/*export const invites = pgTable( "invites", { inviteeID: varchar("invitee_id", { length: 255 }).notNull(), @@ -238,9 +238,9 @@ export const invites = pgTable( (table) => ({ id: primaryKey(table.inviteeID, table.teamID), }), -); +); */ -export const invitesRelations = relations(invites, ({ one }) => ({ +/*export const invitesRelations = relations(invites, ({ one }) => ({ invitee: one(userHackerData, { fields: [invites.inviteeID], references: [userHackerData.clerkID], @@ -249,7 +249,7 @@ export const invitesRelations = relations(invites, ({ one }) => ({ fields: [invites.teamID], references: [teams.id], }), -})); +})); */ export const errorLog = pgTable("error_log", { id: varchar("id", { length: 50 }).notNull().primaryKey(), diff --git a/apps/web/src/actions/teams.ts b/apps/web/src/actions/teams.ts index a257024c..58b632a9 100644 --- a/apps/web/src/actions/teams.ts +++ b/apps/web/src/actions/teams.ts @@ -1,4 +1,4 @@ -"use server"; +/*"use server"; // TODO: update team /api endpoints to be actions import { authenticatedAction } from "@/lib/safe-action"; @@ -84,4 +84,4 @@ export const leaveTeam = authenticatedAction }); return result; - }); + }); */ diff --git a/apps/web/src/app/admin/scanner/[id]/page.tsx b/apps/web/src/app/admin/scanner/[id]/page.tsx index ac0958fb..2451818a 100644 --- a/apps/web/src/app/admin/scanner/[id]/page.tsx +++ b/apps/web/src/app/admin/scanner/[id]/page.tsx @@ -49,7 +49,7 @@ export default async function Page({ ); } - const scanUser = await getHacker(searchParams.user, false); + const scanUser = await getHacker(searchParams.user/*, false*/); const scan = !scanUser ? null diff --git a/apps/web/src/app/admin/users/[slug]/page.tsx b/apps/web/src/app/admin/users/[slug]/page.tsx index 951b148a..dc570c55 100644 --- a/apps/web/src/app/admin/users/[slug]/page.tsx +++ b/apps/web/src/app/admin/users/[slug]/page.tsx @@ -8,7 +8,7 @@ import { AccountInfo, PersonalInfo, ProfileInfo, - TeamInfo, + //TeamInfo, } from "@/components/admin/users/ServerSections"; import { auth } from "@clerk/nextjs/server"; import { notFound } from "next/navigation"; @@ -25,7 +25,7 @@ export default async function Page({ params }: { params: { slug: string } }) { const admin = await getUser(userId); if (!admin || !isUserAdmin(admin)) return notFound(); - const user = await getHacker(params.slug, true); + const user = await getHacker(params.slug/*, true*/); if (!user) { return

User Not Found

; @@ -104,7 +104,7 @@ export default async function Page({ params }: { params: { slug: string } }) { - + {/**/}
diff --git a/apps/web/src/app/api/team/create/route.ts b/apps/web/src/app/api/team/create/route.ts index 435b796b..afe848c8 100644 --- a/apps/web/src/app/api/team/create/route.ts +++ b/apps/web/src/app/api/team/create/route.ts @@ -1,4 +1,4 @@ -import { auth } from "@clerk/nextjs/server"; +/*import { auth } from "@clerk/nextjs/server"; import { NextResponse } from "next/server"; import { db } from "db"; import { eq } from "db/drizzle"; @@ -65,4 +65,4 @@ export async function POST(req: Request) { message: `An error occurred while creating your team. If this is a continuing issue, please reach out to ${c.issueEmail} with error ID ${errorID}.`, }); } -} +} */ 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 712c5809..d8d860a3 100644 --- a/apps/web/src/app/api/team/invite/accept/route.ts +++ b/apps/web/src/app/api/team/invite/accept/route.ts @@ -1,4 +1,4 @@ -import { serverZodResponse } from "@/lib/utils/server/types"; +/*import { serverZodResponse } from "@/lib/utils/server/types"; import { BasicServerValidator } from "@/validators/shared/basic"; import { db } from "db"; import { eq, and } from "db/drizzle"; @@ -104,4 +104,4 @@ export async function POST( }); } -export const runtime = "edge"; +export const runtime = "edge"; */ diff --git a/apps/web/src/app/api/team/invite/create/route.ts b/apps/web/src/app/api/team/invite/create/route.ts index 0876167e..b90c84bc 100644 --- a/apps/web/src/app/api/team/invite/create/route.ts +++ b/apps/web/src/app/api/team/invite/create/route.ts @@ -1,4 +1,4 @@ -import { auth } from "@clerk/nextjs/server"; +/*import { auth } from "@clerk/nextjs/server"; import { db } from "db"; import { eq } from "db/drizzle"; import { userCommonData } from "db/schema"; @@ -89,4 +89,4 @@ export async function POST( }); } -export const runtime = "edge"; +export const runtime = "edge"; */ diff --git a/apps/web/src/app/api/team/invite/decline/route.ts b/apps/web/src/app/api/team/invite/decline/route.ts index 8fab0892..8abe005a 100644 --- a/apps/web/src/app/api/team/invite/decline/route.ts +++ b/apps/web/src/app/api/team/invite/decline/route.ts @@ -1,4 +1,4 @@ -import { auth } from "@clerk/nextjs/server"; +/*import { auth } from "@clerk/nextjs/server"; import { NextResponse } from "next/server"; import { z } from "zod"; import { db } from "db"; @@ -51,4 +51,4 @@ export async function POST(req: Request) { eq(invites.inviteeID, userId), ), ); -} +} */ diff --git a/apps/web/src/app/dash/pass/page.tsx b/apps/web/src/app/dash/pass/page.tsx index f5b478f9..33d2b453 100644 --- a/apps/web/src/app/dash/pass/page.tsx +++ b/apps/web/src/app/dash/pass/page.tsx @@ -24,7 +24,7 @@ export default async function Page() { const user = await currentUser(); if (!user) return null; - const userDbRecord = await getHacker(user.id, false); + const userDbRecord = await getHacker(user.id/*, false*/); if (!userDbRecord) return null; const qrPayload = createQRpayload({ diff --git a/apps/web/src/app/dash/team/new/page.tsx b/apps/web/src/app/dash/team/new/page.tsx index 5d54fe40..269da21d 100644 --- a/apps/web/src/app/dash/team/new/page.tsx +++ b/apps/web/src/app/dash/team/new/page.tsx @@ -1,4 +1,4 @@ -import c from "config"; +/*import c from "config"; import NewTeamForm from "@/components/dash/main/team/NewTeam"; export default async function Page() { @@ -15,4 +15,4 @@ export default async function Page() { ); -} +} */ diff --git a/apps/web/src/app/dash/team/page.tsx b/apps/web/src/app/dash/team/page.tsx index 10599ba7..21871967 100644 --- a/apps/web/src/app/dash/team/page.tsx +++ b/apps/web/src/app/dash/team/page.tsx @@ -1,4 +1,4 @@ -import c from "config"; +/*import c from "config"; import { auth } from "@clerk/nextjs/server"; import { db } from "db"; import { userCommonData } from "db/schema"; @@ -10,7 +10,7 @@ import Image from "next/image"; import TeamInvite from "@/components/dash/team/invite"; import { Fragment } from "react"; import { Badge } from "@/components/shadcn/ui/badge"; -import LeaveTeamButton from "@/components/dash/team/LeaveTeamButton"; +//import LeaveTeamButton from "@/components/dash/team/LeaveTeamButton"; export default async function Page() { const { userId } = await auth(); @@ -40,9 +40,9 @@ export default async function Page() { }, }, }); - if (!user) return null; + if (!user) return null; */ - if (!user.hackerData.teamID) { + {/*if (!user.hackerData.teamID) { return (
@@ -103,7 +103,7 @@ export default async function Page() {
); - } else { + } *//*else { if (!user.hackerData.team) return null; const team = user.hackerData.team; return ( @@ -115,7 +115,7 @@ export default async function Page() { Team - {/*

{users.length} Total Users

*/} +

{users.length} Total Users

@@ -200,4 +200,4 @@ export default async function Page() { } } -export const runtime = "edge"; +export const runtime = "edge"; */} diff --git a/apps/web/src/app/team/[tag]/page.tsx b/apps/web/src/app/team/[tag]/page.tsx index 9bcb1912..cd000a7b 100644 --- a/apps/web/src/app/team/[tag]/page.tsx +++ b/apps/web/src/app/team/[tag]/page.tsx @@ -1,4 +1,4 @@ -import { db } from "db"; +/*import { db } from "db"; import { teams } from "db/schema"; import { notFound } from "next/navigation"; import { eq } from "db/drizzle"; @@ -69,4 +69,4 @@ export default async function Page({ params }: { params: { tag: string } }) { } export const runtime = "edge"; -export const revalidate = 30; +export const revalidate = 30;*/ diff --git a/apps/web/src/app/user/[tag]/page.tsx b/apps/web/src/app/user/[tag]/page.tsx index f4d0c5ed..a06094ca 100644 --- a/apps/web/src/app/user/[tag]/page.tsx +++ b/apps/web/src/app/user/[tag]/page.tsx @@ -10,7 +10,7 @@ import { getHackerByTag } from "db/functions"; export default async function ({ params }: { params: { tag: string } }) { if (!params.tag || params.tag.length <= 1) return notFound(); - const user = await getHackerByTag(params.tag, false); + const user = await getHackerByTag(params.tag/*, false*/); if (!user) return notFound(); return ( diff --git a/apps/web/src/components/admin/users/ServerSections.tsx b/apps/web/src/components/admin/users/ServerSections.tsx index 7c262308..0e920b3f 100644 --- a/apps/web/src/components/admin/users/ServerSections.tsx +++ b/apps/web/src/components/admin/users/ServerSections.tsx @@ -29,10 +29,10 @@ export function ProfileInfo({ user }: { user: Hacker }) {
- + />*/}
@@ -122,7 +122,7 @@ export function TeamInfo({ user }: { user: Hacker }) { ) : null} ); -} +}*/ function Cell({ title, diff --git a/apps/web/src/components/dash/main/team/NewTeam.tsx b/apps/web/src/components/dash/main/team/NewTeam.tsx index 0f79769e..2b3c845a 100644 --- a/apps/web/src/components/dash/main/team/NewTeam.tsx +++ b/apps/web/src/components/dash/main/team/NewTeam.tsx @@ -1,4 +1,4 @@ -"use client"; +/*"use client"; import { useForm } from "react-hook-form"; import { Form, @@ -192,4 +192,4 @@ export default function NewTeamForm() { ); -} +}*/ diff --git a/apps/web/src/components/dash/team/LeaveTeamButton.tsx b/apps/web/src/components/dash/team/LeaveTeamButton.tsx index 5b45a378..279a58eb 100644 --- a/apps/web/src/components/dash/team/LeaveTeamButton.tsx +++ b/apps/web/src/components/dash/team/LeaveTeamButton.tsx @@ -1,4 +1,4 @@ -"use client"; +/*"use client"; import { LogOut } from "lucide-react"; import { Button } from "@/components/shadcn/ui/button"; @@ -51,4 +51,4 @@ export default function LeaveTeamButton({ issueEmail }: LeaveTeamButtonProps) { Leave ); -} +}*/ diff --git a/apps/web/src/components/dash/team/invite.tsx b/apps/web/src/components/dash/team/invite.tsx index 1d3d0f54..c9eaa2c7 100644 --- a/apps/web/src/components/dash/team/invite.tsx +++ b/apps/web/src/components/dash/team/invite.tsx @@ -1,4 +1,4 @@ -"use client"; +/*"use client"; import { Dialog, DialogContent, @@ -81,4 +81,4 @@ export default function TeamInvite() { ); -} +}*/ diff --git a/apps/web/src/components/dash/team/inviteListing.tsx b/apps/web/src/components/dash/team/inviteListing.tsx index 274f19d9..a559b340 100644 --- a/apps/web/src/components/dash/team/inviteListing.tsx +++ b/apps/web/src/components/dash/team/inviteListing.tsx @@ -1,4 +1,4 @@ -"use client"; +/*"use client"; import Link from "next/link"; import { Button } from "@/components/shadcn/ui/button"; @@ -17,4 +17,4 @@ export default function InviteListing() { //
//
// ); -} +}*/ diff --git a/apps/web/src/validators/shared/registration.ts b/apps/web/src/validators/shared/registration.ts index 83f52c9f..07a41455 100644 --- a/apps/web/src/validators/shared/registration.ts +++ b/apps/web/src/validators/shared/registration.ts @@ -185,7 +185,7 @@ export const hackerRegistrationFormValidator = z points: true, profilePhoto: true, checkinTimestamp: true, - teamID: true, + //teamID: true, }); export const hackerRegistrationValidatorLocalStorage = @@ -222,7 +222,7 @@ export const hackerRegistrationValidatorLocalStorage = points: true, profilePhoto: true, checkinTimestamp: true, - teamID: true, + //teamID: true, }); export const hackerRegistrationResumeValidator = z.object({ diff --git a/apps/web/src/validators/shared/team.ts b/apps/web/src/validators/shared/team.ts index 8e1b045c..d92967c0 100644 --- a/apps/web/src/validators/shared/team.ts +++ b/apps/web/src/validators/shared/team.ts @@ -1,4 +1,4 @@ -import { z } from "zod"; +/*import { z } from "zod"; import c from "config"; export const newTeamValidator = z.object({ name: z @@ -32,4 +32,4 @@ export const newTeamValidator = z.object({ export const newInviteValidator = z.object({ inviteeTag: z.string(), -}); +}); */ diff --git a/packages/config/hackkit.config.ts b/packages/config/hackkit.config.ts index 7f6c2cc5..3777a6af 100644 --- a/packages/config/hackkit.config.ts +++ b/packages/config/hackkit.config.ts @@ -977,7 +977,7 @@ const c = { checked: true, }, }, - maxTeamSize: 4, + //maxTeamSize: 4, featureFlags: { core: { requireUsersApproval: false, diff --git a/packages/db/drizzle/0000_chilly_lady_mastermind.sql b/packages/db/drizzle/0000_chilly_lady_mastermind.sql index 619f68db..d0392fde 100644 --- a/packages/db/drizzle/0000_chilly_lady_mastermind.sql +++ b/packages/db/drizzle/0000_chilly_lady_mastermind.sql @@ -67,13 +67,13 @@ CREATE TABLE `files` ( --> statement-breakpoint CREATE UNIQUE INDEX `files_id_unique` ON `files` (`id`);--> statement-breakpoint CREATE UNIQUE INDEX `files_key_unique` ON `files` (`key`);--> statement-breakpoint -CREATE TABLE `invites` ( +/*CREATE TABLE `invites` ( `invitee_id` text(255) NOT NULL, `team_id` text(50) NOT NULL, `created_at` integer DEFAULT (current_timestamp) NOT NULL, `status` text DEFAULT 'pending' NOT NULL, PRIMARY KEY(`invitee_id`, `team_id`) -); +); */ --> statement-breakpoint CREATE TABLE `scans` ( `updated_at` integer DEFAULT (current_timestamp) NOT NULL, @@ -83,7 +83,7 @@ CREATE TABLE `scans` ( PRIMARY KEY(`user_id`, `event_id`) ); --> statement-breakpoint -CREATE TABLE `teams` ( +/*CREATE TABLE `teams` ( `id` text(50) PRIMARY KEY NOT NULL, `name` text(255) NOT NULL, `tag` text(50) NOT NULL, @@ -92,10 +92,10 @@ CREATE TABLE `teams` ( `created_at` integer DEFAULT (current_timestamp) NOT NULL, `owner_id` text(255) NOT NULL, `devpost_url` text(255) -); +); --> statement-breakpoint CREATE UNIQUE INDEX `teams_id_unique` ON `teams` (`id`);--> statement-breakpoint -CREATE UNIQUE INDEX `teams_tag_unique` ON `teams` (`tag`);--> statement-breakpoint +CREATE UNIQUE INDEX `teams_tag_unique` ON `teams` (`tag`);--> statement-breakpoint */ CREATE TABLE `tickets` ( `id` text PRIMARY KEY NOT NULL, `title` text(255) NOT NULL, @@ -157,7 +157,7 @@ CREATE TABLE `user_hacker_data` ( `personal_website` text(100), `resume` text(255) DEFAULT 'https://static.acmutsa.org/No%20Resume%20Provided.pdf' NOT NULL, `group` integer NOT NULL, - `team_id` text(50), + /*`team_id` text(50), */ `points` integer DEFAULT 0 NOT NULL, `has_accepted_mlh_coc` integer NOT NULL, `has_shared_data_with_mlh` integer NOT NULL, diff --git a/packages/db/functions/hacker.ts b/packages/db/functions/hacker.ts index e50b9da1..b80c4af7 100644 --- a/packages/db/functions/hacker.ts +++ b/packages/db/functions/hacker.ts @@ -33,14 +33,14 @@ export function getAllHackers(): Promise { export function getHacker( clerkID: string, - withTeam: boolean, + //withTeam: boolean, ): Promise { // return withTeam // ? _getHackerByIDWithTeam.execute({ _clerkID: clerkID }) // : _getHackerByIDAlone.execute({ _clerkID: clerkID }); return db.query.userCommonData.findFirst({ where: eq(userCommonData.clerkID, clerkID), - with: { hackerData: withTeam ? { with: { team: true } } : true }, + with: { hackerData: /*withTeam ? { with: { team: true } } :*/ true }, }); } @@ -62,13 +62,13 @@ export function getHacker( export function getHackerByTag( hackerTag: string, - withTeam: boolean, + //withTeam: boolean, ): Promise { // return withTeam // ? _getHackerByTagWithTeam.execute({ _hackerTag: hackerTag }) // : _getHackerByTagAlone.execute({ _hackerTag: hackerTag }); return db.query.userCommonData.findFirst({ where: eq(userCommonData.hackerTag, hackerTag), - with: { hackerData: withTeam ? { with: { team: true } } : true }, + with: { hackerData: /*withTeam ? { with: { team: true } } :*/ true }, }); } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index fd2c7845..69cadbff 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -202,7 +202,7 @@ export const userHackerData = sqliteTable("user_hacker_data", { // metadata group: integer("group").notNull(), - teamID: text("team_id", { length: 50 }), + //teamID: text("team_id", { length: 50 }), points: integer("points").notNull().default(0), hasAcceptedMLHCoC: integer("has_accepted_mlh_coc", { mode: "boolean", @@ -220,11 +220,11 @@ export const userHackerRelations = relations( fields: [userHackerData.clerkID], references: [userCommonData.clerkID], }), - team: one(teams, { + /*team: one(teams, { fields: [userHackerData.teamID], references: [teams.id], - }), - invites: many(invites), + }), + invites: many(invites), */ }), ); @@ -287,7 +287,7 @@ export const scansRelations = relations(scans, ({ one }) => ({ }), })); -export const teams = sqliteTable("teams", { +/*export const teams = sqliteTable("teams", { id: text("id", { length: 50 }).notNull().primaryKey().unique(), name: text("name", { length: 255 }).notNull(), tag: text("tag", { length: 50 }).notNull().unique(), @@ -327,7 +327,7 @@ export const invitesRelations = relations(invites, ({ one }) => ({ fields: [invites.teamID], references: [teams.id], }), -})); +})); */ export const errorLog = sqliteTable("error_log", { id: text("id", { length: 50 }).notNull().primaryKey(), diff --git a/packages/db/types.ts b/packages/db/types.ts index b247badb..20bb1e40 100644 --- a/packages/db/types.ts +++ b/packages/db/types.ts @@ -1,15 +1,16 @@ import { InferSelectModel } from "drizzle-orm"; -import { userCommonData, userHackerData, teams, scans, events } from "./schema"; +//add "teams" to import in order to implement teams(removed for V1 release) +import { userCommonData, userHackerData, scans, events } from "./schema"; export interface Scan extends InferSelectModel {} export interface User extends InferSelectModel {} export interface HackerData extends InferSelectModel {} -export interface Team extends InferSelectModel {} +//export interface Team extends InferSelectModel {} export interface Event extends InferSelectModel {} export interface Hacker extends User { hackerData: typeof userHackerData.$inferSelect & { - team?: Team | null; + //team?: Team | null; }; } export interface NoticeOrError { From c0cb8fde32acf30fa990a8d865821cf50dd05cd7 Mon Sep 17 00:00:00 2001 From: ryanMathram <168239412+ryanMathram@users.noreply.github.com> Date: Thu, 24 Jul 2025 21:56:12 -0500 Subject: [PATCH 4/6] Deleted all issues with unimplmented sections fully --- apps/bot/bot.ts | 2 +- apps/infrastructure-migrator/driver.ts | 22 +- apps/infrastructure-migrator/schema.ts | 47 ---- .../src/actions/admin/registration-actions.ts | 11 +- apps/web/src/actions/teams.ts | 87 -------- apps/web/src/app/admin/scanner/[id]/page.tsx | 2 +- apps/web/src/app/admin/toggles/layout.tsx | 7 +- .../app/admin/toggles/registration/page.tsx | 7 +- apps/web/src/app/admin/users/[slug]/page.tsx | 5 +- apps/web/src/app/api/team/create/route.ts | 68 ------ .../src/app/api/team/invite/accept/route.ts | 107 --------- .../src/app/api/team/invite/create/route.ts | 92 -------- .../src/app/api/team/invite/decline/route.ts | 54 ----- apps/web/src/app/dash/pass/page.tsx | 2 +- apps/web/src/app/dash/team/new/page.tsx | 18 -- apps/web/src/app/dash/team/page.tsx | 203 ------------------ apps/web/src/app/register/page.tsx | 3 +- .../src/app/sign-up/[[...sign-up]]/page.tsx | 3 +- apps/web/src/app/team/[tag]/page.tsx | 72 ------- apps/web/src/app/user/[tag]/page.tsx | 2 +- .../admin/toggles/RegistrationSettings.tsx | 34 --- .../components/admin/users/ServerSections.tsx | 41 ---- .../src/components/dash/main/team/NewTeam.tsx | 195 ----------------- .../components/dash/team/LeaveTeamButton.tsx | 54 ----- apps/web/src/components/dash/team/invite.tsx | 84 -------- .../components/dash/team/inviteListing.tsx | 20 -- .../components/events/admin/EditEventForm.tsx | 2 - .../components/events/admin/NewEventForm.tsx | 1 - .../web/src/validators/shared/registration.ts | 4 - apps/web/src/validators/shared/team.ts | 35 --- packages/config/hackkit.config.ts | 3 - .../drizzle/0000_chilly_lady_mastermind.sql | 24 +-- packages/db/drizzle/meta/0000_snapshot.json | 16 -- packages/db/functions/hacker.ts | 4 +- packages/db/schema.ts | 49 ----- packages/db/types.ts | 1 - 36 files changed, 16 insertions(+), 1365 deletions(-) diff --git a/apps/bot/bot.ts b/apps/bot/bot.ts index 78c83dcf..8a39735c 100644 --- a/apps/bot/bot.ts +++ b/apps/bot/bot.ts @@ -200,7 +200,7 @@ app.post("/api/checkDiscordVerification", async (h) => { } console.log("got here 2"); - const user = await getHacker(verification.clerkID/*, false*/); + const user = await getHacker(verification.clerkID); console.log("got here 2 with user", user); if (!user) { console.log("failed cause of no user in db"); diff --git a/apps/infrastructure-migrator/driver.ts b/apps/infrastructure-migrator/driver.ts index 7a5042b6..af9f854f 100644 --- a/apps/infrastructure-migrator/driver.ts +++ b/apps/infrastructure-migrator/driver.ts @@ -30,8 +30,6 @@ const allUserHackerDataPromise = dbPostgres.query.userHackerData.findMany(); const allEventsPromise = dbPostgres.query.events.findMany(); const allFilesPromise = dbPostgres.query.files.findMany(); const allScansPromise = dbPostgres.query.scans.findMany(); -//const allTeamsPromise = dbPostgres.query.teams.findMany(); -//const allInvitesPromise = dbPostgres.query.invites.findMany(); const allErrorLogsPromise = dbPostgres.query.errorLog.findMany(); const alldiscordVerificationPromise = dbPostgres.query.discordVerification.findMany(); @@ -56,8 +54,6 @@ async function migratePostgresSqLite() { allEvents, allFiles, allScans, - //allTeams, - //allInvites, allErrorLogs, alldiscordVerification, allTickets, @@ -71,8 +67,6 @@ async function migratePostgresSqLite() { allEventsPromise, allFilesPromise, allScansPromise, - //allTeamsPromise, - //allInvitesPromise, allErrorLogsPromise, alldiscordVerificationPromise, allTicketsPromise, @@ -133,21 +127,7 @@ async function migratePostgresSqLite() { console.log("Migrated Scans ✅\n\n"); - /*console.log("Migrating Teams 🏆"); - - if (allTeams.length > 0) { - await db.insert(schema.teams).values(allTeams); - } - - console.log("Migrated Teams ✅\n\n"); - - console.log("Migrating Invites 💌"); - - if (allInvites.length > 0) { - await db.insert(schema.invites).values(allInvites); - } - - console.log("Migrated Invites ✅\n\n");*/ + console.log("Migrating Error Logs 📝"); diff --git a/apps/infrastructure-migrator/schema.ts b/apps/infrastructure-migrator/schema.ts index 94ce1438..72a392d0 100644 --- a/apps/infrastructure-migrator/schema.ts +++ b/apps/infrastructure-migrator/schema.ts @@ -132,8 +132,6 @@ export const userHackerData = pgTable("user_hacker_data", { // metadata group: integer("group").notNull(), - //teamID: varchar("team_id", { length: 50 }), - points: integer("points").notNull().default(0), hasAcceptedMLHCoC: boolean("has_accepted_mlh_coc").notNull(), hasSharedDataWithMLH: boolean("has_shared_data_with_mlh").notNull(), isEmailable: boolean("is_emailable").notNull(), @@ -146,11 +144,6 @@ export const userHackerRelations = relations( fields: [userHackerData.clerkID], references: [userCommonData.clerkID], }), - //team: one(teams, { - // fields: [userHackerData.teamID], - // references: [teams.id], - //}), - //invites: many(invites), }), ); @@ -160,7 +153,6 @@ export const events = pgTable("events", { startTime: timestamp("start_time").notNull(), endTime: timestamp("end_time").notNull(), location: varchar("location", { length: 255 }).default("TBD"), - points: integer("points").notNull().default(0), description: text("description").notNull(), type: varchar("type", { length: 50 }).notNull(), host: varchar("host", { length: 255 }), @@ -211,45 +203,6 @@ export const scansRelations = relations(scans, ({ one }) => ({ }), })); -/*export const teams = pgTable("teams", { - id: varchar("id", { length: 50 }).notNull().primaryKey().unique(), - name: varchar("name", { length: 255 }).notNull(), - tag: varchar("tag", { length: 50 }).notNull().unique(), - bio: text("bio"), - photo: varchar("photo", { length: 400 }).notNull(), - createdAt: timestamp("created_at").notNull().defaultNow(), - ownerID: varchar("owner_id", { length: 255 }).notNull(), - devpostURL: varchar("devpost_url", { length: 255 }), -}); */ - -/*export const teamsRelations = relations(teams, ({ one, many }) => ({ - members: many(userHackerData), - invites: many(invites), -})); */ - -/*export const invites = pgTable( - "invites", - { - inviteeID: varchar("invitee_id", { length: 255 }).notNull(), - teamID: varchar("team_id", { length: 50 }).notNull(), - createdAt: timestamp("created_at").notNull().defaultNow(), - status: inviteType("status").notNull().default("pending"), - }, - (table) => ({ - id: primaryKey(table.inviteeID, table.teamID), - }), -); */ - -/*export const invitesRelations = relations(invites, ({ one }) => ({ - invitee: one(userHackerData, { - fields: [invites.inviteeID], - references: [userHackerData.clerkID], - }), - team: one(teams, { - fields: [invites.teamID], - references: [teams.id], - }), -})); */ export const errorLog = pgTable("error_log", { id: varchar("id", { length: 50 }).notNull().primaryKey(), diff --git a/apps/web/src/actions/admin/registration-actions.ts b/apps/web/src/actions/admin/registration-actions.ts index abd0a239..99ab5f06 100644 --- a/apps/web/src/actions/admin/registration-actions.ts +++ b/apps/web/src/actions/admin/registration-actions.ts @@ -32,16 +32,7 @@ export const toggleRegistrationMessageEnabled = adminAction return { success: true, statusSet: enabled }; }); -/*export const toggleSecretRegistrationEnabled = adminAction - .schema(defaultRegistrationToggleSchema) - .action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => { - await redisSet( - "config:registration:secretRegistrationEnabled", - enabled, - ); - revalidatePath("/admin/toggles/registration"); - return { success: true, statusSet: enabled }; - });*/ + export const toggleRSVPs = adminAction .schema(defaultRegistrationToggleSchema) diff --git a/apps/web/src/actions/teams.ts b/apps/web/src/actions/teams.ts index 58b632a9..e69de29b 100644 --- a/apps/web/src/actions/teams.ts +++ b/apps/web/src/actions/teams.ts @@ -1,87 +0,0 @@ -/*"use server"; - -// TODO: update team /api endpoints to be actions -import { authenticatedAction } from "@/lib/safe-action"; -import { boolean, string, z } from "zod"; -import { db } from "db"; -import { userHackerData, teams, invites } from "db/schema"; -import { eq } from "db/drizzle"; -import { revalidatePath } from "next/cache"; -import { getHacker } from "db/functions"; -import { returnValidationErrors } from "next-safe-action"; - -export const leaveTeam = authenticatedAction - .outputSchema( - z.object({ - success: z.boolean(), - message: z.string(), - }), - ) - .action(async ({ ctx: { userId } }) => { - const user = await getHacker(userId, false); - if (!user) - returnValidationErrors(z.null(), { _errors: ["User not found"] }); - - if (!user.hackerData.teamID) { - revalidatePath("/dash/team"); - return { - success: false, - message: "User is not on a team", - }; - } - - const result = await db.transaction(async (tx) => { - await tx - .update(userHackerData) - .set({ teamID: null }) - .where(eq(userHackerData.clerkID, user.clerkID)); - const team = await tx.query.teams.findFirst({ - where: eq(teams.id, user.hackerData.teamID as string), // Converted to string since TS does not realise for some reason that we checked above. - with: { - members: { - with: { - commonData: true, - }, - }, - }, - }); - - if (!team) { - revalidatePath("/dash/team"); - return { - success: false, - message: "Team not found.", - }; - } - - if (team.members.length < 1) { - await tx.delete(teams).where(eq(teams.id, team.id)); - await tx.delete(invites).where(eq(invites.teamID, team.id)); - revalidatePath("/dash/team"); - return { - success: true, - message: - "Team has been left. Team has been deleted since it has no members.", - }; - } - - if (team.ownerID == userId) { - await tx - .update(teams) - .set({ ownerID: team.members[0].clerkID }) - .where(eq(teams.id, team.id)); - revalidatePath("/dash/team"); - return { - success: true, - message: `Team has been left. Ownership has been transferred to ${team.members[0].commonData.firstName} ${team.members[0].commonData.lastName}.`, - }; - } - revalidatePath("/dash/team"); - return { - success: true, - message: "Team has been left.", - }; - }); - - return result; - }); */ diff --git a/apps/web/src/app/admin/scanner/[id]/page.tsx b/apps/web/src/app/admin/scanner/[id]/page.tsx index 2451818a..473be983 100644 --- a/apps/web/src/app/admin/scanner/[id]/page.tsx +++ b/apps/web/src/app/admin/scanner/[id]/page.tsx @@ -49,7 +49,7 @@ export default async function Page({ ); } - const scanUser = await getHacker(searchParams.user/*, false*/); + const scanUser = await getHacker(searchParams.user); const scan = !scanUser ? null diff --git a/apps/web/src/app/admin/toggles/layout.tsx b/apps/web/src/app/admin/toggles/layout.tsx index 51174ae3..2f937cd9 100644 --- a/apps/web/src/app/admin/toggles/layout.tsx +++ b/apps/web/src/app/admin/toggles/layout.tsx @@ -11,15 +11,12 @@ export default function Layout({ children }: ToggleLayoutProps) {
- {/**/} + - {/**/} +
{children}
diff --git a/apps/web/src/app/admin/toggles/registration/page.tsx b/apps/web/src/app/admin/toggles/registration/page.tsx index 78290a4c..270c8855 100644 --- a/apps/web/src/app/admin/toggles/registration/page.tsx +++ b/apps/web/src/app/admin/toggles/registration/page.tsx @@ -6,12 +6,10 @@ import c from "config"; export default async function Page() { const [ defaultRegistrationEnabled, - //defaultSecretRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit, ]: (string | null)[] = await redisMGet( "config:registration:registrationEnabled", - //"config:registration:secretRegistrationEnabled", "config:registration:allowRSVPs", "config:registration:maxRSVPs", ); @@ -28,10 +26,7 @@ export default async function Page() { defaultRegistrationEnabled, true, )} - /*defaultSecretRegistrationEnabled={parseRedisBoolean( - defaultSecretRegistrationEnabled, - false, - )}*/ + defaultRSVPsEnabled={parseRedisBoolean( defaultRSVPsEnabled, true, diff --git a/apps/web/src/app/admin/users/[slug]/page.tsx b/apps/web/src/app/admin/users/[slug]/page.tsx index dc570c55..3189fae1 100644 --- a/apps/web/src/app/admin/users/[slug]/page.tsx +++ b/apps/web/src/app/admin/users/[slug]/page.tsx @@ -8,7 +8,6 @@ import { AccountInfo, PersonalInfo, ProfileInfo, - //TeamInfo, } from "@/components/admin/users/ServerSections"; import { auth } from "@clerk/nextjs/server"; import { notFound } from "next/navigation"; @@ -25,7 +24,7 @@ export default async function Page({ params }: { params: { slug: string } }) { const admin = await getUser(userId); if (!admin || !isUserAdmin(admin)) return notFound(); - const user = await getHacker(params.slug/*, true*/); + const user = await getHacker(params.slug); if (!user) { return

User Not Found

; @@ -104,7 +103,7 @@ export default async function Page({ params }: { params: { slug: string } }) { - {/**/} + diff --git a/apps/web/src/app/api/team/create/route.ts b/apps/web/src/app/api/team/create/route.ts index afe848c8..e69de29b 100644 --- a/apps/web/src/app/api/team/create/route.ts +++ b/apps/web/src/app/api/team/create/route.ts @@ -1,68 +0,0 @@ -/*import { auth } from "@clerk/nextjs/server"; -import { NextResponse } from "next/server"; -import { db } from "db"; -import { eq } from "db/drizzle"; -import { userHackerData, teams } from "db/schema"; -import { getHacker } from "db/functions"; -import { newTeamValidator } from "@/validators/shared/team"; -import { nanoid } from "nanoid"; -import c from "config"; -import { logError } from "@/lib/utils/server/logError"; - -export async function POST(req: Request) { - const { userId } = await auth(); - if (!userId) return new Response("Unauthorized", { status: 401 }); - - const user = await getHacker(userId, false); - if (!user) return new Response("Unauthorized", { status: 401 }); - - if (user.hackerData.teamID) { - return NextResponse.json({ - success: false, - message: - "You are already on a team. Leave your current team to create a new one.", - }); - } - - const rawBody = await req.json(); - const body = newTeamValidator.safeParse(rawBody); - - if (!body.success) { - return NextResponse.json({ - success: false, - message: body.error.message, - }); - } - - const teamID = nanoid(); - - try { - await db.transaction(async (tx) => { - await tx.insert(teams).values({ - id: teamID, - name: body.data.name, - tag: body.data.tag, - photo: body.data.photo, - ownerID: userId, - }); - await tx - .update(userHackerData) - .set({ teamID }) - .where(eq(userHackerData.clerkID, userId)); - }); - return NextResponse.json({ - success: true, - message: body.data.tag, - }); - } catch (e) { - const errorID = await logError({ - error: e, - userID: userId, - route: "/api/team/create", - }); - return NextResponse.json({ - success: false, - message: `An error occurred while creating your team. If this is a continuing issue, please reach out to ${c.issueEmail} with error ID ${errorID}.`, - }); - } -} */ 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 d8d860a3..e69de29b 100644 --- a/apps/web/src/app/api/team/invite/accept/route.ts +++ b/apps/web/src/app/api/team/invite/accept/route.ts @@ -1,107 +0,0 @@ -/*import { serverZodResponse } from "@/lib/utils/server/types"; -import { BasicServerValidator } from "@/validators/shared/basic"; -import { db } from "db"; -import { eq, and } from "db/drizzle"; -import { userCommonData, userHackerData, invites, teams } from "db/schema"; -import { auth } from "@clerk/nextjs/server"; -import { NextResponse } from "next/server"; -import { z } from "zod"; -import c from "config"; - -const inviteAcceptValidator = z.object({ - teamInviteID: z.string().min(1).max(50), -}); - -export async function POST( - req: Request, -): serverZodResponse { - const { userId } = await auth(); - if (!userId) return NextResponse.json("Unauthorized", { status: 401 }); - - const rawBody = req.json(); - const body = inviteAcceptValidator.safeParse(rawBody); - - if (!body.success) { - return NextResponse.json({ - success: false, - message: `Invalid body. Error: ${body.error.message}`, - }); - } - - const user = await db.query.userCommonData.findFirst({ - where: eq(userCommonData.clerkID, userId), - with: { - hackerData: { - with: { - invites: { - where: eq(invites.teamID, body.data.teamInviteID), - }, - }, - }, - }, - }); - if (!user) return NextResponse.json("Unauthorized", { status: 401 }); - - if (user.hackerData.teamID) { - return NextResponse.json({ - success: false, - message: "You are already on a team.", - internalCode: "already_on_team", - }); - } - - if (user.hackerData.invites.length === 0) { - return NextResponse.json({ - success: false, - message: "You have not been invited to this team.", - internalCode: "not_invited", - }); - } - - const team = await db.query.teams.findFirst({ - where: eq(teams.id, user.hackerData.invites[0].teamID), - with: { - members: true, - }, - }); - - if (!team) { - return NextResponse.json({ - success: false, - message: "Team not found", - internalCode: "team_not_found", - }); - } - - if (team.members.length >= c.maxTeamSize) { - return NextResponse.json({ - success: false, - message: "Team is full", - internalCode: "team_full", - }); - } - - await db - .update(userHackerData) - .set({ teamID: user.hackerData.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) - .set({ status: "accepted" }) - .where( - and( - eq(invites.teamID, user.hackerData.invites[0].teamID), - eq(invites.inviteeID, userId), - ), - ); - - return NextResponse.json({ - success: true, - message: "Successfully joined team", - internalCode: "success", - }); -} - -export const runtime = "edge"; */ diff --git a/apps/web/src/app/api/team/invite/create/route.ts b/apps/web/src/app/api/team/invite/create/route.ts index b90c84bc..e69de29b 100644 --- a/apps/web/src/app/api/team/invite/create/route.ts +++ b/apps/web/src/app/api/team/invite/create/route.ts @@ -1,92 +0,0 @@ -/*import { auth } from "@clerk/nextjs/server"; -import { db } from "db"; -import { eq } from "db/drizzle"; -import { userCommonData } from "db/schema"; -import { NextResponse } from "next/server"; -import { newInviteValidator } from "@/validators/shared/team"; -import { BasicServerValidator } from "@/validators/shared/basic"; -import { invites } from "db/schema"; -import { getHacker } from "db/functions"; -import type { serverZodResponse } from "@/lib/utils/server/types"; - -export async function POST( - req: Request, -): serverZodResponse { - const { userId } = await auth(); - if (!userId) return NextResponse.json("Unauthorized", { status: 401 }); - - const user = await getHacker(userId, true); - if (!user) return NextResponse.json("Unauthorized", { status: 401 }); - - if (!user.hackerData.teamID || !user.hackerData.team) { - return NextResponse.json( - { - success: false, - message: - "You are not on a team. Join a team to invite members.", - }, - { status: 400 }, - ); - } - - if (user.hackerData.team.ownerID !== userId) { - return NextResponse.json( - { - success: false, - message: "You are not the owner of this team.", - }, - { status: 400 }, - ); - } - - const rawBody = await req.json(); - const body = newInviteValidator.safeParse(rawBody); - if (!body.success) { - return NextResponse.json({ - success: false, - message: `Invalid body. Error: ${body.error.message}`, - }); - } - - const invitee = await db.query.userCommonData.findFirst({ - where: eq(userCommonData.hackerTag, body.data.inviteeTag), - with: { - hackerData: { - with: { - team: true, - invites: { - where: eq(invites.teamID, user.hackerData.teamID), - }, - }, - }, - }, - }); - - if (!invitee) { - return NextResponse.json({ - success: false, - message: "No user with that tag exists.", - internalCode: "user_not_found", - }); - } - - if (invitee.hackerData.invites.length > 0) { - return NextResponse.json({ - success: false, - message: "That user already has an invite.", - internalCode: "user_already_invited", - }); - } - - await db.insert(invites).values({ - inviteeID: invitee.clerkID, - teamID: user.hackerData.teamID, - }); - - return NextResponse.json({ - success: true, - message: "Invite sent successfully!", - }); -} - -export const runtime = "edge"; */ diff --git a/apps/web/src/app/api/team/invite/decline/route.ts b/apps/web/src/app/api/team/invite/decline/route.ts index 8abe005a..e69de29b 100644 --- a/apps/web/src/app/api/team/invite/decline/route.ts +++ b/apps/web/src/app/api/team/invite/decline/route.ts @@ -1,54 +0,0 @@ -/*import { auth } from "@clerk/nextjs/server"; -import { NextResponse } from "next/server"; -import { z } from "zod"; -import { db } from "db"; -import { userCommonData, invites } from "db/schema"; -import { eq, and } from "db/drizzle"; - -const inviteDeclineValidator = z.object({ - teamInviteID: z.string().min(1).max(50), -}); - -export async function POST(req: Request) { - const { userId } = await auth(); - if (!userId) return NextResponse.json("Unauthorized", { status: 401 }); - - const rawBody = req.json(); - const body = inviteDeclineValidator.safeParse(rawBody); - - if (!body.success) { - return NextResponse.json({ - success: false, - message: `Invalid body. Error: ${body.error.message}`, - }); - } - - // TODO(xander): adjust logic here. null check shouldnt require a join, and invite can be queried directly - const user = await db.query.userCommonData.findFirst({ - where: eq(userCommonData.clerkID, userId), - with: { - hackerData: { - with: { - invites: { - where: eq(invites.teamID, body.data.teamInviteID), - }, - }, - }, - }, - }); - - if (!user) return NextResponse.json("Unauthorized", { status: 401 }); - - // TODO(xander): get invite using body data here to avoid joins above - await db - .update(invites) - .set({ - status: "declined", - }) - .where( - and( - eq(invites.teamID, user.hackerData.invites[0].teamID), - eq(invites.inviteeID, userId), - ), - ); -} */ diff --git a/apps/web/src/app/dash/pass/page.tsx b/apps/web/src/app/dash/pass/page.tsx index 33d2b453..367a2cf7 100644 --- a/apps/web/src/app/dash/pass/page.tsx +++ b/apps/web/src/app/dash/pass/page.tsx @@ -24,7 +24,7 @@ export default async function Page() { const user = await currentUser(); if (!user) return null; - const userDbRecord = await getHacker(user.id/*, false*/); + const userDbRecord = await getHacker(user.id); if (!userDbRecord) return null; const qrPayload = createQRpayload({ diff --git a/apps/web/src/app/dash/team/new/page.tsx b/apps/web/src/app/dash/team/new/page.tsx index 269da21d..e69de29b 100644 --- a/apps/web/src/app/dash/team/new/page.tsx +++ b/apps/web/src/app/dash/team/new/page.tsx @@ -1,18 +0,0 @@ -/*import c from "config"; -import NewTeamForm from "@/components/dash/main/team/NewTeam"; - -export default async function Page() { - return ( -
-
-

{c.hackathonName}

-

- Team -

-
-

New Team

- -
-
- ); -} */ diff --git a/apps/web/src/app/dash/team/page.tsx b/apps/web/src/app/dash/team/page.tsx index 21871967..e69de29b 100644 --- a/apps/web/src/app/dash/team/page.tsx +++ b/apps/web/src/app/dash/team/page.tsx @@ -1,203 +0,0 @@ -/*import c from "config"; -import { auth } from "@clerk/nextjs/server"; -import { db } from "db"; -import { userCommonData } from "db/schema"; -import { eq } from "db/drizzle"; -import { Button } from "@/components/shadcn/ui/button"; -import Link from "next/link"; -import { Plus, User } from "lucide-react"; -import Image from "next/image"; -import TeamInvite from "@/components/dash/team/invite"; -import { Fragment } from "react"; -import { Badge } from "@/components/shadcn/ui/badge"; -//import LeaveTeamButton from "@/components/dash/team/LeaveTeamButton"; - -export default async function Page() { - const { userId } = await auth(); - if (!userId) return null; - - // TODO: make this db query not so bad - const user = await db.query.userCommonData.findFirst({ - where: eq(userCommonData.clerkID, userId), - with: { - hackerData: { - with: { - team: { - with: { - members: { - with: { - commonData: true, - }, - }, - }, - }, - invites: { - with: { - team: true, - }, - }, - }, - }, - }, - }); - if (!user) return null; */ - - {/*if (!user.hackerData.teamID) { - return ( -
-
-

{c.hackathonName}

-

- Team -

-
-
-
-

You are not currently in a team.

- - How do Teams work? - -
-
- - - -
-
-
-

- Invitations -

- {user.hackerData.invites.length > 0 ? ( - user.hackerData.invites.map((invite) => ( -
-
-

- {invite.team.name} -

-

- ~{invite.team.tag} -

-
-
- - - - -
-
- )) - ) : ( -

No Pending Invites

- )} -
-
-
- ); - } *//*else { - if (!user.hackerData.team) return null; - const team = user.hackerData.team; - return ( -
-
-
-
-

- - Team -

-

{users.length} Total Users

-
-
-
- - -
-
-
-
-
- {`Team -
-

- {team.name} -

-

- ~{team.tag} -

-

{team.bio}

-
- - Est.{" "} - {team.createdAt - .toDateString() - .split(" ") - .slice(1) - .join(" ")} - -
-
-
- {team.members.map((member) => ( - - -
-
- {`${member.commonData.hackerTag}'s -
-

- { - member.commonData - .firstName - }{" "} - {member.commonData.lastName} -

-

- @ - { - member.commonData - .hackerTag - } -

-
-
-
- -
- ))} -
-
-
- ); - } -} - -export const runtime = "edge"; */} diff --git a/apps/web/src/app/register/page.tsx b/apps/web/src/app/register/page.tsx index 79c3ae25..1527efe3 100644 --- a/apps/web/src/app/register/page.tsx +++ b/apps/web/src/app/register/page.tsx @@ -19,12 +19,11 @@ export default async function Page() { const registration = await getUser(userId); if (registration) return redirect("/dash"); - const [defaultRegistrationEnabled, /*defaultSecretRegistrationEnabled*/]: ( + const [defaultRegistrationEnabled]: ( | string | null )[] = await redisMGet( "config:registration:registrationEnabled", - //"config:registration:secretRegistrationEnabled", ); if (parseRedisBoolean(defaultRegistrationEnabled, true) === true) { diff --git a/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx b/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx index 6fe0cd76..c86e1fed 100644 --- a/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx +++ b/apps/web/src/app/sign-up/[[...sign-up]]/page.tsx @@ -6,12 +6,11 @@ import { Button } from "@/components/shadcn/ui/button"; import Link from "next/link"; export default async function Page() { - const [defaultRegistrationEnabled, /*defaultSecretRegistrationEnabled*/]: ( + const [defaultRegistrationEnabled]: ( | string | null )[] = await redisMGet( "config:registration:registrationEnabled", - //"config:registration:secretRegistrationEnabled", ); if (parseRedisBoolean(defaultRegistrationEnabled, true) === true) { diff --git a/apps/web/src/app/team/[tag]/page.tsx b/apps/web/src/app/team/[tag]/page.tsx index cd000a7b..e69de29b 100644 --- a/apps/web/src/app/team/[tag]/page.tsx +++ b/apps/web/src/app/team/[tag]/page.tsx @@ -1,72 +0,0 @@ -/*import { db } from "db"; -import { teams } from "db/schema"; -import { notFound } from "next/navigation"; -import { eq } from "db/drizzle"; -import Image from "next/image"; -import Link from "next/link"; -import Navbar from "@/components/shared/Navbar"; - -export default async function Page({ params }: { params: { tag: string } }) { - if (!params.tag || params.tag.length <= 1) return notFound(); - - const team = await db.query.teams.findFirst({ - where: eq(teams.tag, params.tag), - with: { - members: { - with: { - commonData: true, - }, - }, - }, - }); - - if (!team) return notFound(); - - return ( - <> - -
-
-
- {`Team -
-

{team.name}

- {team.bio && team.bio.length > 0 && ( -

{team.bio}

- )} -
- {team.members.map((member) => ( - -
- {`${member.commonData.hackerTag}'s -
-

- {member.commonData.firstName}{" "} - {member.commonData.lastName} -

-

- @{member.commonData.hackerTag} -

-
-
- - ))} -
-
- - ); -} - -export const runtime = "edge"; -export const revalidate = 30;*/ diff --git a/apps/web/src/app/user/[tag]/page.tsx b/apps/web/src/app/user/[tag]/page.tsx index a06094ca..b9ba546f 100644 --- a/apps/web/src/app/user/[tag]/page.tsx +++ b/apps/web/src/app/user/[tag]/page.tsx @@ -10,7 +10,7 @@ import { getHackerByTag } from "db/functions"; export default async function ({ params }: { params: { tag: string } }) { if (!params.tag || params.tag.length <= 1) return notFound(); - const user = await getHackerByTag(params.tag/*, false*/); + const user = await getHackerByTag(params.tag); if (!user) return notFound(); return ( diff --git a/apps/web/src/components/admin/toggles/RegistrationSettings.tsx b/apps/web/src/components/admin/toggles/RegistrationSettings.tsx index 093feb85..4da24497 100644 --- a/apps/web/src/components/admin/toggles/RegistrationSettings.tsx +++ b/apps/web/src/components/admin/toggles/RegistrationSettings.tsx @@ -9,7 +9,6 @@ import { toast } from "sonner"; import { toggleRegistrationEnabled, toggleRegistrationMessageEnabled, - //toggleSecretRegistrationEnabled, toggleRSVPs, setRSVPLimit, } from "@/actions/admin/registration-actions"; @@ -17,29 +16,15 @@ import { UpdateItemWithConfirmation } from "./UpdateItemWithConfirmation"; interface RegistrationTogglesProps { defaultRegistrationEnabled: boolean; - //defaultSecretRegistrationEnabled: boolean; defaultRSVPsEnabled: boolean; defaultRSVPLimit: number; } export function RegistrationToggles({ - //defaultSecretRegistrationEnabled, defaultRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit, }: RegistrationTogglesProps) { - /*const { - execute: executeToggleSecretRegistrationEnabled, - optimisticState: ToggleSecretRegistrationEnabledOptimisticData, - } = useOptimisticAction(toggleSecretRegistrationEnabled, { - currentState: { - success: true, - statusSet: defaultSecretRegistrationEnabled, - }, - updateFn: (state, { enabled }) => { - return { statusSet: enabled, success: true }; - }, - });*/ const { execute: executeToggleRSVPs, @@ -93,25 +78,6 @@ export function RegistrationToggles({ }} /> - {/*
-

- Allow Secret Code Sign-up -

- { - toast.success( - `Secret registration ${checked ? "enabled" : "disabled"} successfully!`, - ); - executeToggleSecretRegistrationEnabled({ - enabled: checked, - }); - }} - /> -
*/}
diff --git a/apps/web/src/components/admin/users/ServerSections.tsx b/apps/web/src/components/admin/users/ServerSections.tsx index 0e920b3f..b0c0d4c9 100644 --- a/apps/web/src/components/admin/users/ServerSections.tsx +++ b/apps/web/src/components/admin/users/ServerSections.tsx @@ -29,10 +29,6 @@ export function ProfileInfo({ user }: { user: Hacker }) {
- {/**/} -
- - {user.hackerData.team ? ( - <> - - - - - ) : null} -
- {user.hackerData.team ? ( - - - - ) : null} - - ); -}*/ function Cell({ title, diff --git a/apps/web/src/components/dash/main/team/NewTeam.tsx b/apps/web/src/components/dash/main/team/NewTeam.tsx index 2b3c845a..e69de29b 100644 --- a/apps/web/src/components/dash/main/team/NewTeam.tsx +++ b/apps/web/src/components/dash/main/team/NewTeam.tsx @@ -1,195 +0,0 @@ -/*"use client"; -import { useForm } from "react-hook-form"; -import { - Form, - FormField, - FormItem, - FormLabel, - FormControl, - FormDescription, - FormMessage, -} from "@/components/shadcn/ui/form"; -import { Input } from "@/components/shadcn/ui/input"; -import { Button } from "@/components/shadcn/ui/button"; -import { z } from "zod"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { Textarea } from "@/components/shadcn/ui/textarea"; -import { zpostSafe } from "@/lib/utils/client/zfetch"; -import { BasicServerValidator } from "@/validators/shared/basic"; -import { useState, useTransition } from "react"; -import { Shell } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { newTeamValidator } from "@/validators/shared/team"; -import c from "config"; -import { put } from "@/lib/utils/client/file-upload"; - -export default function NewTeamForm() { - const formValidator = newTeamValidator.merge( - z.object({ photo: z.instanceof(File) }), - ); - const [loading, setLoading] = useState(false); - const router = useRouter(); - const [isPending, startTransition] = useTransition(); - const form = useForm>({ - resolver: zodResolver(formValidator), - defaultValues: { - name: "", - bio: "", - tag: "", - photo: new File([], ""), - }, - }); - - async function onSubmit(values: z.infer) { - setLoading(true); - - let teamPhotoURL: string | null = null; - const photo = values.photo; - - if (photo) { - // TODO: verify this works with the create team - const url = await put(photo.name, photo, { - presignHandlerUrl: "/api/upload/pfp", - }); - teamPhotoURL = url; - } else { - teamPhotoURL = `https://api.dicebear.com/6.x/shapes/svg?seed=${encodeURIComponent( - values.tag.toLowerCase(), - )}`; - } - - const res = await zpostSafe({ - url: "/api/team/create", - vReq: newTeamValidator, - vRes: BasicServerValidator, - body: { - bio: values.bio, - name: values.name, - tag: values.tag, - photo: teamPhotoURL, - }, - }); - - if (!res.success) { - return alert( - `An unknown error occurred. Please try again later. If this is a continuous issue, please contact us at ${c.issueEmail}.`, - ); - } - if (!res.data.success) { - console.log("error: ", res.data.message); - return alert(res.data.message); - } - - alert("Team Created Successfully! Redirecting to team page..."); - - // Due to weirdness with next router we have to use a react transition here. - - startTransition(() => router.push("/dash/team")); - startTransition(() => router.refresh()); - } - - return ( -
- - ( - - Team Name - - - - - This will be the public display name of your - team. - - - - )} - /> - ( - - TeamTag - -
-
- ~ -
- -
-
- - This will be the public, unique identifier for - your team. - - -
- )} - /> - ( - - Media - - - field.onChange( - e.target.files - ? e.target.files[0] - : null, - ) - } - /> - - - - )} - /> - ( - - Bio - -