Skip to content

Commit

Permalink
feat: add email and a bunch of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-guan committed Sep 19, 2023
1 parent 58049b5 commit eed789f
Show file tree
Hide file tree
Showing 6 changed files with 406 additions and 3 deletions.
7 changes: 7 additions & 0 deletions server/api/event/[id].get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ export default defineEventHandler(event => ({
badgeImage: 'https://www.sst.edu.sg/images/default-source/album/2019-2020/2020-01-24-homecoming/20200124_182000.jpg?sfvrsn=2',
startDateTime: dayjs(Date.now()).valueOf(),
endDateTime: dayjs(Date.now()).valueOf(),
attendees: [
{
id: '123',
name: 'Qin Guan',
admissionKey: '123',
},
],
}))
2 changes: 2 additions & 0 deletions server/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createId } from '@paralleldrive/cuid2'
export const users = sqliteTable('users', {
id: text('id').primaryKey(), // Use Firebase Auth provided ID as SSOT
name: text('name').notNull(), // Ignore Firebase Auth provided values and force user to provide their own
email: text('email').notNull(),
memberId: text('member_id').notNull().unique(), // Member ID for tracking by SSTAA Admin
graduationYear: integer('graduation_year').notNull(),
memberType: text('member_type', {
Expand All @@ -33,6 +34,7 @@ export const events = sqliteTable('events', {
export const usersToEvents = sqliteTable('users_events', {
userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
eventId: text('event_id').notNull().references(() => events.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
admissionKey: text('admission_key').notNull(),
}, t => ({
pk: primaryKey(t.userId, t.eventId),
}))
Expand Down
2 changes: 2 additions & 0 deletions server/drizzle/0001_wealthy_valeria_richards.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE users ADD `email` text NOT NULL;--> statement-breakpoint
ALTER TABLE users_events ADD `admission_key` text NOT NULL;
Loading

0 comments on commit eed789f

Please # to comment.