diff --git a/apps/bot/bot.ts b/apps/bot/bot.ts
index 92140193..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 012bdc1e..5e6b180f 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,22 +127,6 @@ 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 📝");
if (allErrorLogs.length > 0) {
diff --git a/apps/infrastructure-migrator/schema.ts b/apps/infrastructure-migrator/schema.ts
index c326c277..c050daa5 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,46 +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(),
createdAt: timestamp("created_at").notNull().defaultNow(),
diff --git a/apps/web/src/actions/admin/registration-actions.ts b/apps/web/src/actions/admin/registration-actions.ts
index 1d069199..9ad5c027 100644
--- a/apps/web/src/actions/admin/registration-actions.ts
+++ b/apps/web/src/actions/admin/registration-actions.ts
@@ -32,17 +32,6 @@ 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)
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
diff --git a/apps/web/src/actions/teams.ts b/apps/web/src/actions/teams.ts
index a257024c..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 ac0958fb..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 b56bb32d..71e48895 100644
--- a/apps/web/src/app/admin/toggles/layout.tsx
+++ b/apps/web/src/app/admin/toggles/layout.tsx
@@ -10,15 +10,11 @@ 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 841fe64d..626b97d7 100644
--- a/apps/web/src/app/admin/toggles/registration/page.tsx
+++ b/apps/web/src/app/admin/toggles/registration/page.tsx
@@ -4,14 +4,11 @@ import { parseRedisBoolean, parseRedisNumber } from "@/lib/utils/server/redis";
import c from "config";
export default async function Page() {
- const [
- defaultRegistrationEnabled,
- defaultSecretRegistrationEnabled,
- defaultRSVPsEnabled,
- defaultRSVPLimit,
- ]: (string | null)[] = await redisMGet(
+ const [defaultRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit]: (
+ | string
+ | null
+ )[] = await redisMGet(
"config:registration:registrationEnabled",
- "config:registration:secretRegistrationEnabled",
"config:registration:allowRSVPs",
"config:registration:maxRSVPs",
);
@@ -28,10 +25,6 @@ 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 951b148a..a3a64ef4 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,6 @@ 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
deleted file mode 100644
index 435b796b..00000000
--- a/apps/web/src/app/api/team/create/route.ts
+++ /dev/null
@@ -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
deleted file mode 100644
index 712c5809..00000000
--- a/apps/web/src/app/api/team/invite/accept/route.ts
+++ /dev/null
@@ -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
deleted file mode 100644
index 0876167e..00000000
--- a/apps/web/src/app/api/team/invite/create/route.ts
+++ /dev/null
@@ -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
deleted file mode 100644
index 8fab0892..00000000
--- a/apps/web/src/app/api/team/invite/decline/route.ts
+++ /dev/null
@@ -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 f5b478f9..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
deleted file mode 100644
index 5d54fe40..00000000
--- a/apps/web/src/app/dash/team/new/page.tsx
+++ /dev/null
@@ -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
deleted file mode 100644
index 10599ba7..00000000
--- a/apps/web/src/app/dash/team/page.tsx
+++ /dev/null
@@ -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.name}
-
-
- ~{team.tag}
-
-
{team.bio}
-
-
- Est.{" "}
- {team.createdAt
- .toDateString()
- .split(" ")
- .slice(1)
- .join(" ")}
-
-
-
-
- {team.members.map((member) => (
-
-
-
-
-
-
-
- {
- 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 686b872b..a550f912 100644
--- a/apps/web/src/app/register/page.tsx
+++ b/apps/web/src/app/register/page.tsx
@@ -19,12 +19,8 @@ export default async function Page() {
const registration = await getUser(userId);
if (registration) return redirect("/dash");
- const [defaultRegistrationEnabled, defaultSecretRegistrationEnabled]: (
- | string
- | null
- )[] = await redisMGet(
+ 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 ecd4c49f..90518930 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,8 @@ import { Button } from "@/components/shadcn/ui/button";
import Link from "next/link";
export default async function Page() {
- const [defaultRegistrationEnabled, defaultSecretRegistrationEnabled]: (
- | string
- | null
- )[] = await redisMGet(
+ 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
deleted file mode 100644
index 9bcb1912..00000000
--- a/apps/web/src/app/team/[tag]/page.tsx
+++ /dev/null
@@ -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.name}
- {team.bio && team.bio.length > 0 && (
-
{team.bio}
- )}
-
- {team.members.map((member) => (
-
-
-
-
-
- {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 f4d0c5ed..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 bbf699ad..116aa1f3 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,30 +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,
optimisticState: toggleRSVPsOptimisticData,
@@ -93,26 +77,6 @@ export function RegistrationToggles({
}}
/>
- {/* removed until implemented */}
- {/*
-
- 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 7c262308..21b7c6cb 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,
value,
diff --git a/apps/web/src/components/dash/main/team/NewTeam.tsx b/apps/web/src/components/dash/main/team/NewTeam.tsx
index 0f79769e..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 (
-
-
- );
-}
diff --git a/apps/web/src/components/dash/team/LeaveTeamButton.tsx b/apps/web/src/components/dash/team/LeaveTeamButton.tsx
index 5b45a378..e69de29b 100644
--- a/apps/web/src/components/dash/team/LeaveTeamButton.tsx
+++ b/apps/web/src/components/dash/team/LeaveTeamButton.tsx
@@ -1,54 +0,0 @@
-"use client";
-
-import { LogOut } from "lucide-react";
-import { Button } from "@/components/shadcn/ui/button";
-import { leaveTeam } from "@/actions/teams";
-import { useAction } from "next-safe-action/hooks";
-import { toast } from "sonner";
-
-interface LeaveTeamButtonProps {
- issueEmail: string;
-}
-
-export default function LeaveTeamButton({ issueEmail }: LeaveTeamButtonProps) {
- const { execute: runLeaveTeam, status } = useAction(leaveTeam, {
- onSuccess: ({ data }) => {
- if (data) {
- if (data.success) {
- toast.success(data.message);
- } else {
- toast.error(data.message);
- }
- } else {
- toast.dismiss();
- toast.error(
- `An unknown error occured. If this persists, please email ${issueEmail}.`,
- );
- }
- toast.dismiss();
- },
- onError: ({ error }) => {
- toast.dismiss();
- toast.error(
- `An unknown error occured. If this persists, please email ${issueEmail}.`,
- );
- // console.error("Fetch Error: ", error.fetchError);
- console.error("Server Error: ", error.serverError);
- console.error("Validation Error: ", error.validationErrors);
- },
- });
-
- function leave() {
- toast.loading("Leaving team...", {
- duration: 0,
- });
- runLeaveTeam();
- }
-
- return (
-
- );
-}
diff --git a/apps/web/src/components/dash/team/invite.tsx b/apps/web/src/components/dash/team/invite.tsx
index 1d3d0f54..e69de29b 100644
--- a/apps/web/src/components/dash/team/invite.tsx
+++ b/apps/web/src/components/dash/team/invite.tsx
@@ -1,84 +0,0 @@
-"use client";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from "@/components/shadcn/ui/dialog";
-import { Input } from "@/components/shadcn/ui/input";
-import { Label } from "@/components/shadcn/ui/label";
-import { PlusCircle } from "lucide-react";
-import { Button } from "@/components/shadcn/ui/button";
-import { useState } from "react";
-import { zpostSafe } from "@/lib/utils/client/zfetch";
-import { newInviteValidator } from "@/validators/shared/team";
-import { BasicServerValidator } from "@/validators/shared/basic";
-import c from "config";
-import { toast } from "sonner";
-
-export default function TeamInvite() {
- const [hackerTag, setHackerTag] = useState(null);
-
- async function createInvite() {
- if (!hackerTag || hackerTag.length <= 1)
- return alert("Please enter a valid HackerTag.");
- const tagToPost = hackerTag.startsWith("@")
- ? hackerTag.slice(1)
- : hackerTag;
- const res = await zpostSafe({
- url: "/api/team/invite/create",
- vReq: newInviteValidator,
- vRes: BasicServerValidator,
- body: {
- inviteeTag: tagToPost,
- },
- });
- if (!res.success) {
- return alert(
- `An unknown error occured. Please try again later. If this issue persists, please contact ${c.issueEmail}.`,
- );
- }
- if (!res.data.success) return alert(res.data.message);
- toast.success("Invite sent successfully!");
- }
-
- return (
-
- );
-}
diff --git a/apps/web/src/components/dash/team/inviteListing.tsx b/apps/web/src/components/dash/team/inviteListing.tsx
index 274f19d9..e69de29b 100644
--- a/apps/web/src/components/dash/team/inviteListing.tsx
+++ b/apps/web/src/components/dash/team/inviteListing.tsx
@@ -1,20 +0,0 @@
-"use client";
-import Link from "next/link";
-import { Button } from "@/components/shadcn/ui/button";
-
-export default function InviteListing() {
- // return (
- //
- //
- // {invite.team.name}
- // ~{invite.team.tag}
- //
- //
- //
- //
- //
- //
- //
- //
- // );
-}
diff --git a/apps/web/src/components/events/admin/EditEventForm.tsx b/apps/web/src/components/events/admin/EditEventForm.tsx
index b4179c75..87dd0da4 100644
--- a/apps/web/src/components/events/admin/EditEventForm.tsx
+++ b/apps/web/src/components/events/admin/EditEventForm.tsx
@@ -43,7 +43,6 @@ export default function EditEventForm({
type,
host,
endTime,
- points,
startTime,
location,
}: eventEditType & { id: number }) {
@@ -84,7 +83,6 @@ export default function EditEventForm({
type: type as any,
host,
startTime,
- points,
location,
endTime,
},
diff --git a/apps/web/src/components/events/admin/NewEventForm.tsx b/apps/web/src/components/events/admin/NewEventForm.tsx
index f091edea..efc9c0d1 100644
--- a/apps/web/src/components/events/admin/NewEventForm.tsx
+++ b/apps/web/src/components/events/admin/NewEventForm.tsx
@@ -49,7 +49,6 @@ export default function NewEventForm({ defaultDate }: NewEventFormProps) {
type: "" as any,
host: "",
startTime: defaultDate,
- points: 0,
location: "TBD",
endTime: new Date(defaultDate.getTime() + ONE_HOUR_IN_MILLISECONDS),
},
diff --git a/apps/web/src/validators/shared/registration.ts b/apps/web/src/validators/shared/registration.ts
index fde03f7f..e41ab2a7 100644
--- a/apps/web/src/validators/shared/registration.ts
+++ b/apps/web/src/validators/shared/registration.ts
@@ -182,10 +182,8 @@ export const hackerRegistrationFormValidator = z
isRSVPed: true,
isApproved: true,
group: true,
- points: true,
profilePhoto: true,
checkinTimestamp: true,
- teamID: true,
});
export const hackerRegistrationValidatorLocalStorage =
@@ -216,10 +214,8 @@ export const hackerRegistrationValidatorLocalStorage =
isRSVPed: true,
isApproved: true,
group: true,
- points: true,
profilePhoto: true,
checkinTimestamp: 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..e69de29b 100644
--- a/apps/web/src/validators/shared/team.ts
+++ b/apps/web/src/validators/shared/team.ts
@@ -1,35 +0,0 @@
-import { z } from "zod";
-import c from "config";
-export const newTeamValidator = z.object({
- name: z
- .string()
- .min(3, {
- message: "Team name must be at least 3 characters long",
- })
- .max(50, {
- message: "Team name must be less than 50 characters long",
- })
- .regex(/^[a-zA-Z0-9 ]+$/, {
- message:
- "Team name must be alphanumeric and have no special characters",
- }),
- bio: z.string().max(200, {
- message: "Team bio must be less than 200 characters long",
- }),
- tag: z
- .string()
- .min(3, {
- message: "Team Tag must be at least 3 characters long",
- })
- .max(25, {
- message: "Team Tag must be less than 25 characters long",
- })
- .regex(c.registration.hackerTagRegex, {
- message: "Team Tag must be alphanumeric and have no spaces",
- }),
- photo: z.string().url(),
-});
-
-export const newInviteValidator = z.object({
- inviteeTag: z.string(),
-});
diff --git a/packages/config/hackkit.config.ts b/packages/config/hackkit.config.ts
index ff57e404..daf34ec2 100644
--- a/packages/config/hackkit.config.ts
+++ b/packages/config/hackkit.config.ts
@@ -912,9 +912,7 @@ const c = {
Overview: "/admin",
Users: "/admin/users",
Events: "/admin/events",
- // Points: "/admin/points", -- commented out until implemented
"Hackathon Check-in": "/admin/check-in",
- Toggles: "/admin/toggles",
},
},
eventTypes: {
@@ -976,7 +974,6 @@ const c = {
checked: true,
},
},
- 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..1dadc737 100644
--- a/packages/db/drizzle/0000_chilly_lady_mastermind.sql
+++ b/packages/db/drizzle/0000_chilly_lady_mastermind.sql
@@ -49,7 +49,6 @@ CREATE TABLE `events` (
`start_time` integer NOT NULL,
`end_time` integer NOT NULL,
`location` text(255) DEFAULT 'TBD',
- `points` integer DEFAULT 0 NOT NULL,
`description` text NOT NULL,
`type` text(50) NOT NULL,
`host` text(255),
@@ -67,13 +66,7 @@ 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` (
- `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,19 +76,6 @@ CREATE TABLE `scans` (
PRIMARY KEY(`user_id`, `event_id`)
);
--> statement-breakpoint
-CREATE TABLE `teams` (
- `id` text(50) PRIMARY KEY NOT NULL,
- `name` text(255) NOT NULL,
- `tag` text(50) NOT NULL,
- `bio` text,
- `photo` text(400) NOT NULL,
- `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 TABLE `tickets` (
`id` text PRIMARY KEY NOT NULL,
`title` text(255) NOT NULL,
@@ -157,8 +137,6 @@ 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),
- `points` integer DEFAULT 0 NOT NULL,
`has_accepted_mlh_coc` integer NOT NULL,
`has_shared_data_with_mlh` integer NOT NULL,
`is_emailable` integer NOT NULL,
diff --git a/packages/db/drizzle/meta/0000_snapshot.json b/packages/db/drizzle/meta/0000_snapshot.json
index 4ad15a48..747b1779 100644
--- a/packages/db/drizzle/meta/0000_snapshot.json
+++ b/packages/db/drizzle/meta/0000_snapshot.json
@@ -329,14 +329,6 @@
"autoincrement": false,
"default": "'TBD'"
},
- "points": {
- "name": "points",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
"description": {
"name": "description",
"type": "text",
@@ -1041,14 +1033,6 @@
"notNull": false,
"autoincrement": false
},
- "points": {
- "name": "points",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
"has_accepted_mlh_coc": {
"name": "has_accepted_mlh_coc",
"type": "integer",
diff --git a/packages/db/functions/hacker.ts b/packages/db/functions/hacker.ts
index e50b9da1..f32623e7 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: 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: true },
});
}
diff --git a/packages/db/schema.ts b/packages/db/schema.ts
index fd2c7845..607a71ca 100644
--- a/packages/db/schema.ts
+++ b/packages/db/schema.ts
@@ -202,8 +202,6 @@ export const userHackerData = sqliteTable("user_hacker_data", {
// metadata
group: integer("group").notNull(),
- teamID: text("team_id", { length: 50 }),
- points: integer("points").notNull().default(0),
hasAcceptedMLHCoC: integer("has_accepted_mlh_coc", {
mode: "boolean",
}).notNull(),
@@ -220,11 +218,6 @@ export const userHackerRelations = relations(
fields: [userHackerData.clerkID],
references: [userCommonData.clerkID],
}),
- team: one(teams, {
- fields: [userHackerData.teamID],
- references: [teams.id],
- }),
- invites: many(invites),
}),
);
@@ -234,7 +227,6 @@ export const events = sqliteTable("events", {
startTime: integer("start_time", { mode: "timestamp_ms" }).notNull(),
endTime: integer("end_time", { mode: "timestamp_ms" }).notNull(),
location: text("location", { length: 255 }).default("TBD"),
- points: integer("points").notNull().default(0),
description: text("description").notNull(),
type: text("type", { length: 50 }).notNull(),
host: text("host", { length: 255 }),
@@ -287,48 +279,6 @@ export const scansRelations = relations(scans, ({ one }) => ({
}),
}));
-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(),
- bio: text("bio"),
- photo: text("photo", { length: 400 }).notNull(),
- createdAt: integer("created_at", { mode: "timestamp_ms" })
- .notNull()
- .default(sql`(current_timestamp)`),
- ownerID: text("owner_id", { length: 255 }).notNull(),
- devpostURL: text("devpost_url", { length: 255 }),
-});
-
-export const teamsRelations = relations(teams, ({ one, many }) => ({
- members: many(userHackerData),
- invites: many(invites),
-}));
-
-export const invites = sqliteTable(
- "invites",
- {
- inviteeID: text("invitee_id", { length: 255 }).notNull(),
- teamID: text("team_id", { length: 50 }).notNull(),
- createdAt: integer("created_at", { mode: "timestamp_ms" })
- .notNull()
- .default(sql`(current_timestamp)`),
- status: inviteType("status").notNull().default("pending"),
- },
- (table) => [primaryKey({ columns: [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 = sqliteTable("error_log", {
id: text("id", { length: 50 }).notNull().primaryKey(),
createdAt: integer("created_at", { mode: "timestamp_ms" })
diff --git a/packages/db/types.ts b/packages/db/types.ts
index b247badb..ec18ed24 100644
--- a/packages/db/types.ts
+++ b/packages/db/types.ts
@@ -1,16 +1,15 @@
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;
- };
+ hackerData: typeof userHackerData.$inferSelect & {};
}
export interface NoticeOrError {
message: string | undefined;
|