Skip to content

Commit 669f21b

Browse files
authored
Remove Unimplemented Sections (#190)
* Clearing out admin "coming soon" and some of the unused config variables * Cleared out Secret Registration sections * Commented out all code that related to teams and invites * Deleted all issues with unimplemented sections fully
1 parent 7883df2 commit 669f21b

File tree

36 files changed

+21
-1389
lines changed

36 files changed

+21
-1389
lines changed

apps/bot/bot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ app.post("/api/checkDiscordVerification", async (h) => {
200200
}
201201
console.log("got here 2");
202202

203-
const user = await getHacker(verification.clerkID, false);
203+
const user = await getHacker(verification.clerkID);
204204
console.log("got here 2 with user", user);
205205
if (!user) {
206206
console.log("failed cause of no user in db");

apps/infrastructure-migrator/driver.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ const allUserHackerDataPromise = dbPostgres.query.userHackerData.findMany();
3030
const allEventsPromise = dbPostgres.query.events.findMany();
3131
const allFilesPromise = dbPostgres.query.files.findMany();
3232
const allScansPromise = dbPostgres.query.scans.findMany();
33-
const allTeamsPromise = dbPostgres.query.teams.findMany();
34-
const allInvitesPromise = dbPostgres.query.invites.findMany();
3533
const allErrorLogsPromise = dbPostgres.query.errorLog.findMany();
3634
const alldiscordVerificationPromise =
3735
dbPostgres.query.discordVerification.findMany();
@@ -56,8 +54,6 @@ async function migratePostgresSqLite() {
5654
allEvents,
5755
allFiles,
5856
allScans,
59-
allTeams,
60-
allInvites,
6157
allErrorLogs,
6258
alldiscordVerification,
6359
allTickets,
@@ -71,8 +67,6 @@ async function migratePostgresSqLite() {
7167
allEventsPromise,
7268
allFilesPromise,
7369
allScansPromise,
74-
allTeamsPromise,
75-
allInvitesPromise,
7670
allErrorLogsPromise,
7771
alldiscordVerificationPromise,
7872
allTicketsPromise,
@@ -133,22 +127,6 @@ async function migratePostgresSqLite() {
133127

134128
console.log("Migrated Scans ✅\n\n");
135129

136-
console.log("Migrating Teams 🏆");
137-
138-
if (allTeams.length > 0) {
139-
await db.insert(schema.teams).values(allTeams);
140-
}
141-
142-
console.log("Migrated Teams ✅\n\n");
143-
144-
console.log("Migrating Invites 💌");
145-
146-
if (allInvites.length > 0) {
147-
await db.insert(schema.invites).values(allInvites);
148-
}
149-
150-
console.log("Migrated Invites ✅\n\n");
151-
152130
console.log("Migrating Error Logs 📝");
153131

154132
if (allErrorLogs.length > 0) {

apps/infrastructure-migrator/schema.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ export const userHackerData = pgTable("user_hacker_data", {
132132

133133
// metadata
134134
group: integer("group").notNull(),
135-
teamID: varchar("team_id", { length: 50 }),
136-
points: integer("points").notNull().default(0),
137135
hasAcceptedMLHCoC: boolean("has_accepted_mlh_coc").notNull(),
138136
hasSharedDataWithMLH: boolean("has_shared_data_with_mlh").notNull(),
139137
isEmailable: boolean("is_emailable").notNull(),
@@ -146,11 +144,6 @@ export const userHackerRelations = relations(
146144
fields: [userHackerData.clerkID],
147145
references: [userCommonData.clerkID],
148146
}),
149-
team: one(teams, {
150-
fields: [userHackerData.teamID],
151-
references: [teams.id],
152-
}),
153-
invites: many(invites),
154147
}),
155148
);
156149

@@ -160,7 +153,6 @@ export const events = pgTable("events", {
160153
startTime: timestamp("start_time").notNull(),
161154
endTime: timestamp("end_time").notNull(),
162155
location: varchar("location", { length: 255 }).default("TBD"),
163-
points: integer("points").notNull().default(0),
164156
description: text("description").notNull(),
165157
type: varchar("type", { length: 50 }).notNull(),
166158
host: varchar("host", { length: 255 }),
@@ -211,46 +203,6 @@ export const scansRelations = relations(scans, ({ one }) => ({
211203
}),
212204
}));
213205

214-
export const teams = pgTable("teams", {
215-
id: varchar("id", { length: 50 }).notNull().primaryKey().unique(),
216-
name: varchar("name", { length: 255 }).notNull(),
217-
tag: varchar("tag", { length: 50 }).notNull().unique(),
218-
bio: text("bio"),
219-
photo: varchar("photo", { length: 400 }).notNull(),
220-
createdAt: timestamp("created_at").notNull().defaultNow(),
221-
ownerID: varchar("owner_id", { length: 255 }).notNull(),
222-
devpostURL: varchar("devpost_url", { length: 255 }),
223-
});
224-
225-
export const teamsRelations = relations(teams, ({ one, many }) => ({
226-
members: many(userHackerData),
227-
invites: many(invites),
228-
}));
229-
230-
export const invites = pgTable(
231-
"invites",
232-
{
233-
inviteeID: varchar("invitee_id", { length: 255 }).notNull(),
234-
teamID: varchar("team_id", { length: 50 }).notNull(),
235-
createdAt: timestamp("created_at").notNull().defaultNow(),
236-
status: inviteType("status").notNull().default("pending"),
237-
},
238-
(table) => ({
239-
id: primaryKey(table.inviteeID, table.teamID),
240-
}),
241-
);
242-
243-
export const invitesRelations = relations(invites, ({ one }) => ({
244-
invitee: one(userHackerData, {
245-
fields: [invites.inviteeID],
246-
references: [userHackerData.clerkID],
247-
}),
248-
team: one(teams, {
249-
fields: [invites.teamID],
250-
references: [teams.id],
251-
}),
252-
}));
253-
254206
export const errorLog = pgTable("error_log", {
255207
id: varchar("id", { length: 50 }).notNull().primaryKey(),
256208
createdAt: timestamp("created_at").notNull().defaultNow(),

apps/web/src/actions/admin/registration-actions.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ export const toggleRegistrationMessageEnabled = adminAction
3232
return { success: true, statusSet: enabled };
3333
});
3434

35-
export const toggleSecretRegistrationEnabled = adminAction
36-
.schema(defaultRegistrationToggleSchema)
37-
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
38-
await redisSet(
39-
"config:registration:secretRegistrationEnabled",
40-
enabled,
41-
);
42-
revalidatePath("/admin/toggles/registration");
43-
return { success: true, statusSet: enabled };
44-
});
45-
4635
export const toggleRSVPs = adminAction
4736
.schema(defaultRegistrationToggleSchema)
4837
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {

apps/web/src/actions/teams.ts

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +0,0 @@
1-
"use server";
2-
3-
// TODO: update team /api endpoints to be actions
4-
import { authenticatedAction } from "@/lib/safe-action";
5-
import { boolean, string, z } from "zod";
6-
import { db } from "db";
7-
import { userHackerData, teams, invites } from "db/schema";
8-
import { eq } from "db/drizzle";
9-
import { revalidatePath } from "next/cache";
10-
import { getHacker } from "db/functions";
11-
import { returnValidationErrors } from "next-safe-action";
12-
13-
export const leaveTeam = authenticatedAction
14-
.outputSchema(
15-
z.object({
16-
success: z.boolean(),
17-
message: z.string(),
18-
}),
19-
)
20-
.action(async ({ ctx: { userId } }) => {
21-
const user = await getHacker(userId, false);
22-
if (!user)
23-
returnValidationErrors(z.null(), { _errors: ["User not found"] });
24-
25-
if (!user.hackerData.teamID) {
26-
revalidatePath("/dash/team");
27-
return {
28-
success: false,
29-
message: "User is not on a team",
30-
};
31-
}
32-
33-
const result = await db.transaction(async (tx) => {
34-
await tx
35-
.update(userHackerData)
36-
.set({ teamID: null })
37-
.where(eq(userHackerData.clerkID, user.clerkID));
38-
const team = await tx.query.teams.findFirst({
39-
where: eq(teams.id, user.hackerData.teamID as string), // Converted to string since TS does not realise for some reason that we checked above.
40-
with: {
41-
members: {
42-
with: {
43-
commonData: true,
44-
},
45-
},
46-
},
47-
});
48-
49-
if (!team) {
50-
revalidatePath("/dash/team");
51-
return {
52-
success: false,
53-
message: "Team not found.",
54-
};
55-
}
56-
57-
if (team.members.length < 1) {
58-
await tx.delete(teams).where(eq(teams.id, team.id));
59-
await tx.delete(invites).where(eq(invites.teamID, team.id));
60-
revalidatePath("/dash/team");
61-
return {
62-
success: true,
63-
message:
64-
"Team has been left. Team has been deleted since it has no members.",
65-
};
66-
}
67-
68-
if (team.ownerID == userId) {
69-
await tx
70-
.update(teams)
71-
.set({ ownerID: team.members[0].clerkID })
72-
.where(eq(teams.id, team.id));
73-
revalidatePath("/dash/team");
74-
return {
75-
success: true,
76-
message: `Team has been left. Ownership has been transferred to ${team.members[0].commonData.firstName} ${team.members[0].commonData.lastName}.`,
77-
};
78-
}
79-
revalidatePath("/dash/team");
80-
return {
81-
success: true,
82-
message: "Team has been left.",
83-
};
84-
});
85-
86-
return result;
87-
});

apps/web/src/app/admin/scanner/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default async function Page({
4949
);
5050
}
5151

52-
const scanUser = await getHacker(searchParams.user, false);
52+
const scanUser = await getHacker(searchParams.user);
5353

5454
const scan = !scanUser
5555
? null

apps/web/src/app/admin/toggles/layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ export default function Layout({ children }: ToggleLayoutProps) {
1010
<div className="min-h-screen">
1111
<ToggleItem name="Toggles" path="/admin/toggles" />
1212
<ToggleItem name="Landing Page" path="/admin/toggles/landing" />
13-
<ToggleItem name="Tickets" path="/admin/toggles/tickets" />
13+
1414
<ToggleItem
1515
name="Registration & RSVP"
1616
path="/admin/toggles/registration"
1717
/>
18-
<ToggleItem
19-
name="User Dashboard"
20-
path="/admin/toggles/dashboard"
21-
/>
2218
</div>
2319
<div className="col-span-4">{children}</div>
2420
</div>

apps/web/src/app/admin/toggles/registration/page.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import { parseRedisBoolean, parseRedisNumber } from "@/lib/utils/server/redis";
44
import c from "config";
55

66
export default async function Page() {
7-
const [
8-
defaultRegistrationEnabled,
9-
defaultSecretRegistrationEnabled,
10-
defaultRSVPsEnabled,
11-
defaultRSVPLimit,
12-
]: (string | null)[] = await redisMGet(
7+
const [defaultRegistrationEnabled, defaultRSVPsEnabled, defaultRSVPLimit]: (
8+
| string
9+
| null
10+
)[] = await redisMGet(
1311
"config:registration:registrationEnabled",
14-
"config:registration:secretRegistrationEnabled",
1512
"config:registration:allowRSVPs",
1613
"config:registration:maxRSVPs",
1714
);
@@ -28,10 +25,6 @@ export default async function Page() {
2825
defaultRegistrationEnabled,
2926
true,
3027
)}
31-
defaultSecretRegistrationEnabled={parseRedisBoolean(
32-
defaultSecretRegistrationEnabled,
33-
false,
34-
)}
3528
defaultRSVPsEnabled={parseRedisBoolean(
3629
defaultRSVPsEnabled,
3730
true,

apps/web/src/app/admin/users/[slug]/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
AccountInfo,
99
PersonalInfo,
1010
ProfileInfo,
11-
TeamInfo,
1211
} from "@/components/admin/users/ServerSections";
1312
import { auth } from "@clerk/nextjs/server";
1413
import { notFound } from "next/navigation";
@@ -25,7 +24,7 @@ export default async function Page({ params }: { params: { slug: string } }) {
2524
const admin = await getUser(userId);
2625
if (!admin || !isUserAdmin(admin)) return notFound();
2726

28-
const user = await getHacker(params.slug, true);
27+
const user = await getHacker(params.slug);
2928

3029
if (!user) {
3130
return <p className="text-center font-bold">User Not Found</p>;
@@ -104,7 +103,6 @@ export default async function Page({ params }: { params: { slug: string } }) {
104103
<PersonalInfo user={user} />
105104
<ProfileInfo user={user} />
106105
<AccountInfo user={user} />
107-
<TeamInfo user={user} />
108106
</div>
109107
</div>
110108
</main>

apps/web/src/app/api/team/create/route.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)