This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: finish initial drizzle schemas
- Loading branch information
1 parent
67b8f4e
commit 6816257
Showing
13 changed files
with
432 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
integer, | ||
pgEnum, | ||
serial, | ||
timestamp, | ||
varchar, | ||
} from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { project } from "./project"; | ||
import { user } from "./user"; | ||
|
||
export const bookmarkTypeEnum = pgEnum("bookmarkEnum", [ | ||
"participant", | ||
"project", | ||
]); | ||
|
||
export const bookmark = pgTable("bookmark", { | ||
id: serial("id").primaryKey(), | ||
user: integer("user").references(() => user.id), | ||
participant: integer("participant").references(() => user.id), | ||
project: varchar("project", { length: 255 }) | ||
.notNull() | ||
.references(() => project.id), | ||
type: bookmarkTypeEnum("type").notNull(), | ||
description: varchar("description", { length: 255 }), | ||
createdAt: timestamp("createdAt").notNull().defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { integer, serial, timestamp } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { checkinItem } from "./checkinItem"; | ||
import { event } from "./event"; | ||
import { user } from "./user"; | ||
|
||
export const checkin = pgTable("checkin", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
user: integer("user") | ||
.notNull() | ||
.references(() => user.id), | ||
item: integer("item") | ||
.notNull() | ||
.references(() => checkinItem.id), | ||
createdAt: timestamp("created_at").defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
boolean, | ||
integer, | ||
pgEnum, | ||
serial, | ||
timestamp, | ||
varchar, | ||
} from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
|
||
export const checkinAccessLevelEnum = pgEnum("checkin_access_level", [ | ||
"all", | ||
"sponsors_only", | ||
"participants_only", | ||
"admins_only", | ||
]); | ||
|
||
export const checkinItem = pgTable("checkin_item", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
name: varchar("name", { length: 256 }).notNull(), | ||
description: varchar("description", { length: 256 }).notNull(), | ||
startTime: timestamp("start_time").notNull(), | ||
endTime: timestamp("end_time").notNull(), | ||
points: integer("points").default(0), | ||
accessLevel: checkinAccessLevelEnum("access_level").default("all"), | ||
active: boolean("active").default(true), | ||
enableSelfCheckin: boolean("enable_self_checkin").default(false), | ||
createdAt: timestamp("created_at").defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { boolean, serial } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
|
||
export const confirmation = pgTable("confirmation", { | ||
id: serial("id").primaryKey(), | ||
signatureLiability: boolean("signature_liability").notNull(), | ||
signatureCodeOfConduct: boolean("signature_code_of_conduct").notNull(), | ||
signaturePhotoRelease: boolean("signature_photo_release").default(false), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
integer, | ||
pgEnum, | ||
serial, | ||
timestamp, | ||
varchar, | ||
} from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
import { user } from "./user"; | ||
|
||
export const emailGroupEnum = pgEnum("email_group", [ | ||
"participants_verified", | ||
"participants_completed", | ||
"participants_confirmed", | ||
"sponsors", | ||
"admins", | ||
]); | ||
export const emailStatusEnum = pgEnum("email_status", [ | ||
"queued", | ||
"sent", | ||
"error", | ||
"deleted", | ||
]); | ||
export const email = pgTable("email", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
sender: integer("sender") | ||
.notNull() | ||
.references(() => user.id), | ||
group: emailGroupEnum("group").default("admins"), | ||
status: emailStatusEnum("status").default("queued"), | ||
subject: varchar("subject", { length: 256 }).notNull(), | ||
body: varchar("body", { length: 256 }).notNull(), | ||
sentTime: timestamp("sent_time"), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { integer, serial, timestamp, varchar } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
import { project } from "./project"; | ||
import { sponsor } from "./sponsor"; | ||
|
||
export const prize = pgTable("prize", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
name: varchar("name", { length: 256 }).notNull(), | ||
description: varchar("description", { length: 256 }).notNull(), | ||
eligibility: varchar("eligibility", { length: 256 }), | ||
provider: integer("provider").references(() => sponsor.id), | ||
winner: integer("winner").references(() => project.id), | ||
createdAt: timestamp("created_at").defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { relations } from "drizzle-orm"; | ||
import { boolean, integer, pgEnum, serial, varchar } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { confirmation } from "./confirmation"; | ||
import { event } from "./event"; | ||
import { sponsor } from "./sponsor"; | ||
import { user } from "./user"; | ||
|
||
export const CMUCollegeEnum = pgEnum("cmu_college", [ | ||
"scs", | ||
"cit", | ||
"cfa", | ||
"dietrich", | ||
"mcs", | ||
"tepper", | ||
"heinz", | ||
]); | ||
|
||
export const CollegeLevelEnum = pgEnum("college_level", [ | ||
"undergraduate", | ||
"masters", | ||
"doctorate", | ||
"other", | ||
]); | ||
|
||
export const GenderEnum = pgEnum("gender", [ | ||
"male", | ||
"female", | ||
"prefer_not_to_say", | ||
"other", | ||
]); | ||
|
||
export const EthnicityEnum = pgEnum("ethnicity", [ | ||
"native_american", | ||
"asian", | ||
"black", | ||
"pacific_islander", | ||
"white", | ||
"hispanic", | ||
"prefer_not_to_say", | ||
"other", | ||
]); | ||
|
||
export const HackathonExperienceEnum = pgEnum("hackathon_experience", [ | ||
"zero", | ||
"one_to_three", | ||
"four_plus", | ||
]); | ||
|
||
export const WorkPermissionEnum = pgEnum("work_permission", [ | ||
"citizen", | ||
"sponsorship", | ||
"no_sponsorship", | ||
]); | ||
|
||
export const ShirtSizeEnum = pgEnum("shirt_size", [ | ||
"xs", | ||
"s", | ||
"m", | ||
"l", | ||
"xl", | ||
"xxl", | ||
"wxs", | ||
"ws", | ||
"wm", | ||
"wl", | ||
"wxl", | ||
"wxxl", | ||
]); | ||
|
||
export const RegionEnum = pgEnum("region", ["rural", "suburban", "urban"]); | ||
|
||
export const profile = pgTable("profile", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
user: integer("user") | ||
.notNull() | ||
.references(() => user.id), | ||
firstName: varchar("first_name", { length: 256 }).notNull(), | ||
middleName: varchar("middle_name", { length: 256 }), | ||
lastName: varchar("last_name", { length: 256 }).notNull(), | ||
displayName: varchar("display_name", { length: 256 }).notNull(), | ||
age: integer("age"), | ||
school: varchar("school", { length: 256 }).notNull(), | ||
college: CMUCollegeEnum("college"), | ||
collegeLevel: CollegeLevelEnum("college_level"), | ||
graduationYear: integer("graduation_year").notNull(), | ||
gender: GenderEnum("gender").notNull(), | ||
genderOther: varchar("gender_other", { length: 256 }), | ||
ethnicity: EthnicityEnum("ethnicity"), | ||
totalPoints: integer("total_points").default(0), | ||
major: varchar("major", { length: 256 }), | ||
linkedin: varchar("linkedin", { length: 256 }), | ||
hackathonExperience: HackathonExperienceEnum("hackathon_experience"), | ||
workPermission: WorkPermissionEnum("work_permission"), | ||
workLocation: varchar("work_location", { length: 256 }), | ||
workStrengths: varchar("work_strengths", { length: 256 }), | ||
resume: varchar("resume", { length: 256 }), | ||
github: varchar("github", { length: 256 }).notNull(), | ||
design: varchar("design", { length: 256 }), | ||
website: varchar("website", { length: 256 }), | ||
essays: varchar("essays", { length: 256 }).array(), | ||
dietaryRestrictions: varchar("dietary_restrictions", { length: 256 }).array(), | ||
shirtSize: ShirtSizeEnum("shirt_size"), | ||
wantHardware: boolean("want_hardware"), | ||
address: varchar("address", { length: 256 }), | ||
region: RegionEnum("region"), | ||
confirmation: integer("confirmation").references(() => confirmation.id), | ||
attendingPhysically: boolean("attending_physically").default(false), | ||
notes: varchar("notes", { length: 256 }), | ||
}); | ||
|
||
export const profileRelations = relations(profile, ({ many }) => ({ | ||
sponsorRanking: many(sponsor), | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { relations } from "drizzle-orm"; | ||
import { | ||
boolean, | ||
integer, | ||
serial, | ||
timestamp, | ||
varchar, | ||
} from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { prize } from "./prize"; | ||
import { team } from "./team"; | ||
|
||
export const project = pgTable("project", { | ||
id: serial("id").primaryKey(), | ||
name: varchar("name", { length: 256 }).notNull(), | ||
description: varchar("description", { length: 256 }).notNull(), | ||
url: varchar("url", { length: 256 }), | ||
location: varchar("location", { length: 256 }), | ||
slides: varchar("slides", { length: 256 }), | ||
video: varchar("video", { length: 256 }), | ||
team: integer("team") | ||
.notNull() | ||
.references(() => team.id), | ||
presentingVirtually: boolean("presenting_virtually").default(false), | ||
createdAt: timestamp("created_at").defaultNow(), | ||
}); | ||
|
||
export const projectRelations = relations(project, ({ many }) => ({ | ||
prizes: many(prize), | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { integer, serial, varchar } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
import { user } from "./user"; | ||
|
||
export const recruiter = pgTable("recruiter", { | ||
id: serial("id").primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
user: integer("user") | ||
.notNull() | ||
.references(() => user.id), | ||
firstName: varchar("firstName", { length: 255 }), | ||
lastName: varchar("lastName", { length: 255 }), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
boolean, | ||
integer, | ||
pgEnum, | ||
timestamp, | ||
varchar, | ||
} from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
|
||
export const platformEnum = pgEnum("platformEnum", [ | ||
"in_person", | ||
"zoom", | ||
"hop_in", | ||
"discord", | ||
"youtube", | ||
"hybrid", | ||
"other", | ||
]); | ||
|
||
export const scheduleItem = pgTable("scheduleItem", { | ||
id: varchar("id", { length: 255 }).notNull().primaryKey(), | ||
event: integer("event") | ||
.notNull() | ||
.references(() => event.id), | ||
name: varchar("name", { length: 255 }).notNull(), | ||
description: varchar("description", { length: 255 }), | ||
startTime: timestamp("startTime").notNull(), | ||
endTime: timestamp("endTime").notNull(), | ||
location: varchar("location", { length: 255 }).notNull(), | ||
lat: varchar("lat", { length: 255 }), | ||
lng: varchar("lng", { length: 255 }), | ||
platform: platformEnum("platform").default("in_person"), | ||
platformURL: varchar("platformURL", { length: 255 }), | ||
active: boolean("active").default(true), | ||
createdAt: timestamp("createdAt").notNull().defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { boolean, integer, timestamp, varchar } from "drizzle-orm/pg-core"; | ||
|
||
import { pgTable } from "./_table"; | ||
import { event } from "./event"; | ||
|
||
export const settings = pgTable("settings", { | ||
id: varchar("id", { length: 255 }).notNull().primaryKey(), | ||
event: varchar("event", { length: 255 }) | ||
.notNull() | ||
.references(() => event.id), | ||
timeOpen: timestamp("timeOpen").notNull(), | ||
timeClose: timestamp("timeClose").notNull(), | ||
timeConfirm: timestamp("timeConfirm").notNull(), | ||
enableWhitelist: boolean("enableWhitelist"), | ||
whitelistedEmails: varchar("whitelistedEmails", { length: 255 }).array(), | ||
maxParticipants: integer("maxParticipants"), | ||
autoWaitlist: boolean("autoWaitlist"), | ||
waitlistText: varchar("waitlistText", { length: 255 }), | ||
acceptanceText: varchar("acceptanceText", { length: 255 }), | ||
confirmationText: varchar("confirmationText", { length: 255 }), | ||
allowMinors: boolean("allowMinors"), | ||
maxTeamSize: integer("maxTeamSize"), | ||
createdAt: timestamp("createdAt").notNull().defaultNow(), | ||
}); |
Oops, something went wrong.