Skip to content

Commit 3045548

Browse files
committed
feat: complete participant registration
1 parent 409f1bf commit 3045548

File tree

13 files changed

+511
-82
lines changed

13 files changed

+511
-82
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The architecture of this project revolves around a streamlined development and d
3434
- [x] Edit workshop
3535
- [ ] Interactive workshop session(e.g video conferencing, live chat code editor)
3636
- [x] Delete workshop
37-
- [ ] Participant registration
37+
- [x] Participant registration
3838
- [ ] Join workshops with workshop code
3939
- [ ] Complete workshop & dashboard page
4040

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ALTER TABLE "registrations" RENAME COLUMN "participant_id" TO "registrant_id";--> statement-breakpoint
2+
ALTER TABLE "registrations" DROP CONSTRAINT "registrations_participant_id_unique";--> statement-breakpoint
3+
ALTER TABLE "registrations" DROP CONSTRAINT "registrations_participant_id_users_id_fk";
4+
--> statement-breakpoint
5+
DO $$ BEGIN
6+
ALTER TABLE "registrations" ADD CONSTRAINT "registrations_registrant_id_users_id_fk" FOREIGN KEY ("registrant_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
7+
EXCEPTION
8+
WHEN duplicate_object THEN null;
9+
END $$;
10+
--> statement-breakpoint
11+
ALTER TABLE "registrations" ADD CONSTRAINT "registrations_registrant_id_unique" UNIQUE("registrant_id");
+298
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
{
2+
"id": "8ffad2dd-f372-4e8d-8e86-57e1473cf678",
3+
"prevId": "4dfe737c-9e8c-4902-aaa0-a9f825346b2d",
4+
"version": "5",
5+
"dialect": "pg",
6+
"tables": {
7+
"registrations": {
8+
"name": "registrations",
9+
"schema": "",
10+
"columns": {
11+
"id": {
12+
"name": "id",
13+
"type": "varchar(30)",
14+
"primaryKey": true,
15+
"notNull": true
16+
},
17+
"workshop_id": {
18+
"name": "workshop_id",
19+
"type": "varchar(30)",
20+
"primaryKey": false,
21+
"notNull": true
22+
},
23+
"registrant_id": {
24+
"name": "registrant_id",
25+
"type": "varchar(30)",
26+
"primaryKey": false,
27+
"notNull": true
28+
},
29+
"registered_at": {
30+
"name": "registered_at",
31+
"type": "timestamp",
32+
"primaryKey": false,
33+
"notNull": true,
34+
"default": "now()"
35+
}
36+
},
37+
"indexes": {},
38+
"foreignKeys": {
39+
"registrations_workshop_id_workshops_id_fk": {
40+
"name": "registrations_workshop_id_workshops_id_fk",
41+
"tableFrom": "registrations",
42+
"tableTo": "workshops",
43+
"columnsFrom": [
44+
"workshop_id"
45+
],
46+
"columnsTo": [
47+
"id"
48+
],
49+
"onDelete": "cascade",
50+
"onUpdate": "no action"
51+
},
52+
"registrations_registrant_id_users_id_fk": {
53+
"name": "registrations_registrant_id_users_id_fk",
54+
"tableFrom": "registrations",
55+
"tableTo": "users",
56+
"columnsFrom": [
57+
"registrant_id"
58+
],
59+
"columnsTo": [
60+
"id"
61+
],
62+
"onDelete": "no action",
63+
"onUpdate": "no action"
64+
}
65+
},
66+
"compositePrimaryKeys": {},
67+
"uniqueConstraints": {
68+
"registrations_workshop_id_unique": {
69+
"name": "registrations_workshop_id_unique",
70+
"nullsNotDistinct": false,
71+
"columns": [
72+
"workshop_id"
73+
]
74+
},
75+
"registrations_registrant_id_unique": {
76+
"name": "registrations_registrant_id_unique",
77+
"nullsNotDistinct": false,
78+
"columns": [
79+
"registrant_id"
80+
]
81+
}
82+
}
83+
},
84+
"sessions": {
85+
"name": "sessions",
86+
"schema": "",
87+
"columns": {
88+
"id": {
89+
"name": "id",
90+
"type": "text",
91+
"primaryKey": true,
92+
"notNull": true
93+
},
94+
"user_id": {
95+
"name": "user_id",
96+
"type": "varchar(30)",
97+
"primaryKey": false,
98+
"notNull": true
99+
},
100+
"expires_at": {
101+
"name": "expires_at",
102+
"type": "timestamp with time zone",
103+
"primaryKey": false,
104+
"notNull": true
105+
}
106+
},
107+
"indexes": {},
108+
"foreignKeys": {
109+
"sessions_user_id_users_id_fk": {
110+
"name": "sessions_user_id_users_id_fk",
111+
"tableFrom": "sessions",
112+
"tableTo": "users",
113+
"columnsFrom": [
114+
"user_id"
115+
],
116+
"columnsTo": [
117+
"id"
118+
],
119+
"onDelete": "no action",
120+
"onUpdate": "no action"
121+
}
122+
},
123+
"compositePrimaryKeys": {},
124+
"uniqueConstraints": {}
125+
},
126+
"users": {
127+
"name": "users",
128+
"schema": "",
129+
"columns": {
130+
"id": {
131+
"name": "id",
132+
"type": "varchar(30)",
133+
"primaryKey": true,
134+
"notNull": true
135+
},
136+
"name": {
137+
"name": "name",
138+
"type": "varchar(50)",
139+
"primaryKey": false,
140+
"notNull": true
141+
},
142+
"github_id": {
143+
"name": "github_id",
144+
"type": "integer",
145+
"primaryKey": false,
146+
"notNull": true
147+
},
148+
"email": {
149+
"name": "email",
150+
"type": "varchar(50)",
151+
"primaryKey": false,
152+
"notNull": true
153+
},
154+
"image": {
155+
"name": "image",
156+
"type": "text",
157+
"primaryKey": false,
158+
"notNull": false
159+
},
160+
"created_at": {
161+
"name": "created_at",
162+
"type": "timestamp",
163+
"primaryKey": false,
164+
"notNull": true,
165+
"default": "now()"
166+
},
167+
"updated_at": {
168+
"name": "updated_at",
169+
"type": "timestamp",
170+
"primaryKey": false,
171+
"notNull": false,
172+
"default": "current_timestamp"
173+
}
174+
},
175+
"indexes": {
176+
"user_github_idx": {
177+
"name": "user_github_idx",
178+
"columns": [
179+
"github_id"
180+
],
181+
"isUnique": false
182+
}
183+
},
184+
"foreignKeys": {},
185+
"compositePrimaryKeys": {},
186+
"uniqueConstraints": {
187+
"users_github_id_unique": {
188+
"name": "users_github_id_unique",
189+
"nullsNotDistinct": false,
190+
"columns": [
191+
"github_id"
192+
]
193+
}
194+
}
195+
},
196+
"workshops": {
197+
"name": "workshops",
198+
"schema": "",
199+
"columns": {
200+
"id": {
201+
"name": "id",
202+
"type": "varchar(30)",
203+
"primaryKey": true,
204+
"notNull": true
205+
},
206+
"organizer_id": {
207+
"name": "organizer_id",
208+
"type": "varchar(30)",
209+
"primaryKey": false,
210+
"notNull": true
211+
},
212+
"title": {
213+
"name": "title",
214+
"type": "varchar(50)",
215+
"primaryKey": false,
216+
"notNull": true
217+
},
218+
"description": {
219+
"name": "description",
220+
"type": "text",
221+
"primaryKey": false,
222+
"notNull": true
223+
},
224+
"date": {
225+
"name": "date",
226+
"type": "timestamp",
227+
"primaryKey": false,
228+
"notNull": true
229+
},
230+
"duration": {
231+
"name": "duration",
232+
"type": "integer",
233+
"primaryKey": false,
234+
"notNull": true
235+
},
236+
"is_public": {
237+
"name": "is_public",
238+
"type": "boolean",
239+
"primaryKey": false,
240+
"notNull": true
241+
},
242+
"access_code": {
243+
"name": "access_code",
244+
"type": "varchar(8)",
245+
"primaryKey": false,
246+
"notNull": true
247+
},
248+
"created_at": {
249+
"name": "created_at",
250+
"type": "timestamp",
251+
"primaryKey": false,
252+
"notNull": true,
253+
"default": "now()"
254+
},
255+
"updated_at": {
256+
"name": "updated_at",
257+
"type": "timestamp",
258+
"primaryKey": false,
259+
"notNull": false,
260+
"default": "current_timestamp"
261+
}
262+
},
263+
"indexes": {},
264+
"foreignKeys": {
265+
"workshops_organizer_id_users_id_fk": {
266+
"name": "workshops_organizer_id_users_id_fk",
267+
"tableFrom": "workshops",
268+
"tableTo": "users",
269+
"columnsFrom": [
270+
"organizer_id"
271+
],
272+
"columnsTo": [
273+
"id"
274+
],
275+
"onDelete": "no action",
276+
"onUpdate": "no action"
277+
}
278+
},
279+
"compositePrimaryKeys": {},
280+
"uniqueConstraints": {
281+
"workshops_access_code_unique": {
282+
"name": "workshops_access_code_unique",
283+
"nullsNotDistinct": false,
284+
"columns": [
285+
"access_code"
286+
]
287+
}
288+
}
289+
}
290+
},
291+
"enums": {},
292+
"schemas": {},
293+
"_meta": {
294+
"columns": {},
295+
"schemas": {},
296+
"tables": {}
297+
}
298+
}

drizzle/migrations/meta/_journal.json

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@
5050
"when": 1718393969645,
5151
"tag": "0006_deep_xorn",
5252
"breakpoints": true
53+
},
54+
{
55+
"idx": 7,
56+
"version": "5",
57+
"when": 1718820349734,
58+
"tag": "0007_exotic_shriek",
59+
"breakpoints": true
5360
}
5461
]
5562
}

0 commit comments

Comments
 (0)