Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"date-fns-tz": "^3.1.3",
"db": "workspace:*",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.31.2",
"drizzle-zod": "^0.5.1",
"drizzle-orm": "^0.39.3",
"drizzle-zod": "^0.7.0",
"embla-carousel": "8.1.7",
"embla-carousel-autoplay": "8.1.7",
"embla-carousel-react": "8.1.7",
Expand Down
18 changes: 9 additions & 9 deletions apps/web/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Link from 'next/link'
import Link from "next/link";

// TODO: make this look better

export default function NotFound() {
return (
<div>
<h2>Not Found</h2>
<p>Could not find requested resource</p>
<Link href="/">Return Home</Link>
</div>
)
return (
<div>
<h2>Not Found</h2>
<p>Could not find requested resource</p>
<Link href="/">Return Home</Link>
</div>
);
}

export const runtime = "edge";
3 changes: 1 addition & 2 deletions apps/web/src/validators/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import c from "config";
export const newEventFormSchema = createInsertSchema(events, {
title: z.string().min(1),
description: z.string().min(1),
location: z.string().min(1),
startTime: z.date(),
endTime: z.date(),
host: z.string().optional(),
host: z.string().max(255).nullable(),
type: z.enum(Object.keys(c.eventTypes) as EventTypeEnum),
}).refine(({ startTime, endTime }) => startTime < endTime, {
message: "Start time must be before end time",
Expand Down
13 changes: 13 additions & 0 deletions apps/web/src/validators/shared/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ export const hackerRegistrationValidatorLocalStorage =
.or(z.string())
.pipe(z.coerce.number()),
accommodationNote: z.string(),
skills: z
.array(
z.object({
id: z.string().min(1).max(50),
text: z.string().min(1).max(50),
}),
)
.min(1, {
message: "You must have at least one skill",
})
.max(c.registration.maxNumberOfSkills, {
message: `You cannot have more than ${c.registration.maxNumberOfSkills} skills`,
}),
})
.omit({
clerkID: true,
Expand Down
20 changes: 19 additions & 1 deletion packages/config/hackkit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,16 @@ const perms = [
"super_admin",
] as const;

const discordInviteStatus = ["pending", "accepted", "declined"] as const;

const ticketStatus = ["awaiting", "in_progress", "completed"] as const;
const discordVerificationStatus = [
"pending",
"expired",
"accepted",
"rejected",
] as const;

// These are routes (pages) which do not require a account / authentication. They are used in the authMiddleware in middleware.ts. Be careful which routes you add here!

const publicRoutes = [
Expand All @@ -1010,4 +1020,12 @@ const publicRoutes = [
];

export default c;
export { defaultTheme, bucketResumeBaseUploadUrl, perms, publicRoutes };
export {
defaultTheme,
bucketResumeBaseUploadUrl,
perms,
discordInviteStatus,
ticketStatus,
discordVerificationStatus,
publicRoutes,
};
18 changes: 3 additions & 15 deletions packages/db/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@ dotenv.config({
path: "../../.env",
});

// export default {
// schema: "./schema.ts",
// out: "./drizzle",
// // driver: "pg", Can be removed as of version 0.21.0 or above https://orm.drizzle.team/kit-docs/upgrade-21
// dbCredentials: {
// connectionString: `${process.env.POSTGRES_URL as string}?sslmode=require`,
// },
// breakpoints: true,
// } satisfies Config;

// driver: "pg", Can be removed as of version 0.21.0 or above https://orm.drizzle.team/kit-docs/upgrade-21
// Connection string also removed

export default defineConfig({
schema: "./schema.ts",
dialect: "postgresql",
out: "./drizzle",
dialect: "turso",
dbCredentials: {
url: `${process.env.POSTGRES_URL as string}?sslmode=require`,
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN,
},
breakpoints: true,
});
166 changes: 166 additions & 0 deletions packages/db/drizzle/0000_chilly_lady_mastermind.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
CREATE TABLE `chat_messages` (
`id` integer PRIMARY KEY NOT NULL,
`chat_id` text NOT NULL,
`message` text NOT NULL,
`author_id` text NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL
);
--> statement-breakpoint
CREATE TABLE `chats` (
`id` text PRIMARY KEY NOT NULL,
`type` text NOT NULL,
`ticket_id` text,
`author` text NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL,
FOREIGN KEY (`ticket_id`) REFERENCES `tickets`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `chats_to_users` (
`chat_id` text NOT NULL,
`user_id` text NOT NULL,
PRIMARY KEY(`user_id`, `chat_id`),
FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`user_id`) REFERENCES `user_common_data`(`clerk_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `discord_verification` (
`code` text(255) PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL,
`clerk_id` text(255),
`discord_user_id` text(255) NOT NULL,
`discord_user_tag` text(255) NOT NULL,
`discord_profile_photo` text(255) NOT NULL,
`discord_name` text(255) NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`guild` text(100) NOT NULL
);
--> statement-breakpoint
CREATE TABLE `error_log` (
`id` text(50) PRIMARY KEY NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL,
`user_id` text(255),
`route` text(255),
`message` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `events` (
`id` integer PRIMARY KEY NOT NULL,
`name` text(255) NOT NULL,
`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),
`hidden` integer DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE `files` (
`id` text(255) PRIMARY KEY NOT NULL,
`presigned_url` text NOT NULL,
`key` text(500) NOT NULL,
`validated` integer DEFAULT false NOT NULL,
`type` text NOT NULL,
`owner_id` text(255) NOT NULL
);
--> 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,
`user_id` text(255) NOT NULL,
`event_id` integer NOT NULL,
`count` integer NOT NULL,
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,
`description` text NOT NULL,
`status` text DEFAULT 'awaiting' NOT NULL,
`created_at` integer DEFAULT (current_timestamp) NOT NULL
);
--> statement-breakpoint
CREATE TABLE `tickets_to_users` (
`ticket_id` text NOT NULL,
`user_id` text NOT NULL,
PRIMARY KEY(`user_id`, `ticket_id`),
FOREIGN KEY (`ticket_id`) REFERENCES `tickets`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`user_id`) REFERENCES `user_common_data`(`clerk_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `user_common_data` (
`clerk_id` text(255) PRIMARY KEY NOT NULL,
`first_name` text(50) NOT NULL,
`last_name` text(50) NOT NULL,
`email` text(255) NOT NULL,
`hacker_tag` text(50) NOT NULL,
`age` integer NOT NULL,
`gender` text(50) NOT NULL,
`race` text(75) NOT NULL,
`ethnicity` text(50) NOT NULL,
`shirt_size` text(5) NOT NULL,
`diet_restrictions` text DEFAULT '[]' NOT NULL,
`accommodation_note` text,
`discord` text(60),
`pronouns` text(20) NOT NULL,
`bio` text NOT NULL,
`skills` text DEFAULT '[]' NOT NULL,
`profile_photo` text(255) NOT NULL,
`phone_number` text(30) NOT NULL,
`country_of_residence` text(3) NOT NULL,
`is_fully_registered` integer DEFAULT false NOT NULL,
`signup_time` integer DEFAULT (current_timestamp) NOT NULL,
`is_searchable` integer DEFAULT true NOT NULL,
`role` text DEFAULT 'hacker' NOT NULL,
`checkin_timestamp` integer,
`is_rsvped` integer DEFAULT false NOT NULL,
`is_approved` integer DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `user_common_data_email_unique` ON `user_common_data` (`email`);--> statement-breakpoint
CREATE UNIQUE INDEX `user_common_data_hacker_tag_unique` ON `user_common_data` (`hacker_tag`);--> statement-breakpoint
CREATE TABLE `user_hacker_data` (
`clerk_id` text(255) PRIMARY KEY NOT NULL,
`university` text(200) NOT NULL,
`major` text(200) NOT NULL,
`school_id` text(50) NOT NULL,
`level_of_study` text(50) NOT NULL,
`hackathons_attended` integer NOT NULL,
`software_experience` text(25) NOT NULL,
`heard_from` text(50),
`github` text(100),
`linkedin` text(100),
`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,
FOREIGN KEY (`clerk_id`) REFERENCES `user_common_data`(`clerk_id`) ON UPDATE no action ON DELETE cascade
);
Loading