Skip to content

Commit 10493b6

Browse files
committed
chore: coding standards
1 parent 3dddff6 commit 10493b6

11 files changed

Lines changed: 122 additions & 183 deletions

File tree

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import { Route } from "./+types/api.events.$id.register";
22

33
export async function action({ params, context }: Route.ActionArgs) {
4-
const { id } = params;
5-
const event = await context.queryClient.getEventById(id);
6-
if(!event) {
7-
return Response.json({ success: false, error: 'Event not found' }, { status: 404, statusText: 'Event not found' });
8-
}
9-
if(!event.lumaEventId) {
10-
return Response.json({ success: false, error: 'Event not yet open' }, { status: 401, statusText: 'Event not yet open' });
11-
}
12-
// try {
13-
// const attendees = await context.lumaClient.getAllAttendees(event.lumaEventId);
14-
// } catch(error: unknown) {
15-
// const message = error instaceof Error ? error.message : 'Something went wrong';
16-
// return new Response.json({ success: false, error: message})
17-
// }
18-
return Response.json({ success: true });
19-
}
4+
const { id } = params;
5+
const event = await context.queryClient.getEventById(id);
6+
if (!event) {
7+
return Response.json(
8+
{ success: false, error: "Event not found" },
9+
{ status: 404, statusText: "Event not found" },
10+
);
11+
}
12+
if (!event.lumaEventId) {
13+
return Response.json(
14+
{ success: false, error: "Event not yet open" },
15+
{ status: 401, statusText: "Event not yet open" },
16+
);
17+
}
18+
// try {
19+
// const attendees = await context.lumaClient.getAllAttendees(event.lumaEventId);
20+
// } catch(error: unknown) {
21+
// const message = error instaceof Error ? error.message : 'Something went wrong';
22+
// return new Response.json({ success: false, error: message})
23+
// }
24+
return Response.json({ success: true });
25+
}

website/app/routes/api.events.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Route } from "./+types/api.events";
22

33
export async function loader({ context }: Route.ActionArgs) {
4-
const events = await context.queryClient.getPublishedUpcomingEvents();
5-
const data = events.map((event) => ({
6-
id: event.id,
7-
slug: event.slug,
8-
name: event.name,
9-
startDate: event.startDate,
10-
location: event.shortLocation,
11-
}));
12-
return Response.json({ success: true, data });
13-
}
4+
const events = await context.queryClient.getPublishedUpcomingEvents();
5+
const data = events.map((event) => ({
6+
id: event.id,
7+
slug: event.slug,
8+
name: event.name,
9+
startDate: event.startDate,
10+
location: event.shortLocation,
11+
}));
12+
return Response.json({ success: true, data });
13+
}

website/app/routes/api.speakers.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Route } from "./+types/api.speakers";
22

33
export async function loader({ context }: Route.ActionArgs) {
4-
const speakersWithTalks = await context.queryClient.getSpeakersWithTalks();
5-
const data = speakersWithTalks.speakers.map((speaker) => ({
6-
name: speaker.name,
7-
title: speaker.title,
8-
link: speaker.socials.linkedinUrl || speaker.socials.twitterUrl || speaker.socials.blueskyUrl,
9-
10-
}));
11-
return Response.json({ success: true, data });
4+
const speakersWithTalks = await context.queryClient.getSpeakersWithTalks();
5+
const data = speakersWithTalks.speakers.map((speaker) => ({
6+
name: speaker.name,
7+
title: speaker.title,
8+
link:
9+
speaker.socials.linkedinUrl ||
10+
speaker.socials.twitterUrl ||
11+
speaker.socials.blueskyUrl,
12+
}));
13+
return Response.json({ success: true, data });
1214
}

website/app/routes/img.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
1313
: "./data/images",
1414
getImgSource: ({ request }) => {
1515
const src = new URL(request.url).searchParams.get("src");
16-
if(!src) {
16+
if (!src) {
1717
return new Response("src query parameter is required", { status: 400 });
1818
}
1919
if (URL.canParse(src)) {

website/migrations/meta/0003_snapshot.json

Lines changed: 35 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,17 @@
4040
"name": "event_images_event_id_events_id_fk",
4141
"tableFrom": "event_images",
4242
"tableTo": "events",
43-
"columnsFrom": [
44-
"event_id"
45-
],
46-
"columnsTo": [
47-
"id"
48-
],
43+
"columnsFrom": ["event_id"],
44+
"columnsTo": ["id"],
4945
"onDelete": "cascade",
5046
"onUpdate": "no action"
5147
},
5248
"event_images_image_id_images_id_fk": {
5349
"name": "event_images_image_id_images_id_fk",
5450
"tableFrom": "event_images",
5551
"tableTo": "images",
56-
"columnsFrom": [
57-
"image_id"
58-
],
59-
"columnsTo": [
60-
"id"
61-
],
52+
"columnsFrom": ["image_id"],
53+
"columnsTo": ["id"],
6254
"onDelete": "cascade",
6355
"onUpdate": "no action"
6456
}
@@ -105,25 +97,17 @@
10597
"name": "event_sponsors_event_id_events_id_fk",
10698
"tableFrom": "event_sponsors",
10799
"tableTo": "events",
108-
"columnsFrom": [
109-
"event_id"
110-
],
111-
"columnsTo": [
112-
"id"
113-
],
100+
"columnsFrom": ["event_id"],
101+
"columnsTo": ["id"],
114102
"onDelete": "cascade",
115103
"onUpdate": "no action"
116104
},
117105
"event_sponsors_sponsor_id_sponsors_id_fk": {
118106
"name": "event_sponsors_sponsor_id_sponsors_id_fk",
119107
"tableFrom": "event_sponsors",
120108
"tableTo": "sponsors",
121-
"columnsFrom": [
122-
"sponsor_id"
123-
],
124-
"columnsTo": [
125-
"id"
126-
],
109+
"columnsFrom": ["sponsor_id"],
110+
"columnsTo": ["id"],
127111
"onDelete": "cascade",
128112
"onUpdate": "no action"
129113
}
@@ -170,25 +154,17 @@
170154
"name": "event_talks_event_id_events_id_fk",
171155
"tableFrom": "event_talks",
172156
"tableTo": "events",
173-
"columnsFrom": [
174-
"event_id"
175-
],
176-
"columnsTo": [
177-
"id"
178-
],
157+
"columnsFrom": ["event_id"],
158+
"columnsTo": ["id"],
179159
"onDelete": "cascade",
180160
"onUpdate": "no action"
181161
},
182162
"event_talks_talk_id_talks_id_fk": {
183163
"name": "event_talks_talk_id_talks_id_fk",
184164
"tableFrom": "event_talks",
185165
"tableTo": "talks",
186-
"columnsFrom": [
187-
"talk_id"
188-
],
189-
"columnsTo": [
190-
"id"
191-
],
166+
"columnsFrom": ["talk_id"],
167+
"columnsTo": ["id"],
192168
"onDelete": "cascade",
193169
"onUpdate": "no action"
194170
}
@@ -323,12 +299,8 @@
323299
"name": "events_preview_image_images_id_fk",
324300
"tableFrom": "events",
325301
"tableTo": "images",
326-
"columnsFrom": [
327-
"preview_image"
328-
],
329-
"columnsTo": [
330-
"id"
331-
],
302+
"columnsFrom": ["preview_image"],
303+
"columnsTo": ["id"],
332304
"onDelete": "set null",
333305
"onUpdate": "no action"
334306
}
@@ -338,16 +310,12 @@
338310
"events_slug_unique": {
339311
"name": "events_slug_unique",
340312
"nullsNotDistinct": false,
341-
"columns": [
342-
"slug"
343-
]
313+
"columns": ["slug"]
344314
},
345315
"events_luma_event_id_unique": {
346316
"name": "events_luma_event_id_unique",
347317
"nullsNotDistinct": false,
348-
"columns": [
349-
"luma_event_id"
350-
]
318+
"columns": ["luma_event_id"]
351319
}
352320
},
353321
"policies": {},
@@ -390,12 +358,8 @@
390358
"name": "hack_users_hack_id_hacks_id_fk",
391359
"tableFrom": "hack_users",
392360
"tableTo": "hacks",
393-
"columnsFrom": [
394-
"hack_id"
395-
],
396-
"columnsTo": [
397-
"id"
398-
],
361+
"columnsFrom": ["hack_id"],
362+
"columnsTo": ["id"],
399363
"onDelete": "cascade",
400364
"onUpdate": "no action"
401365
}
@@ -449,12 +413,8 @@
449413
"name": "hack_votes_hack_id_hacks_id_fk",
450414
"tableFrom": "hack_votes",
451415
"tableTo": "hacks",
452-
"columnsFrom": [
453-
"hack_id"
454-
],
455-
"columnsTo": [
456-
"id"
457-
],
416+
"columnsFrom": ["hack_id"],
417+
"columnsTo": ["id"],
458418
"onDelete": "cascade",
459419
"onUpdate": "no action"
460420
}
@@ -514,12 +474,8 @@
514474
"name": "hacks_event_id_events_id_fk",
515475
"tableFrom": "hacks",
516476
"tableTo": "events",
517-
"columnsFrom": [
518-
"event_id"
519-
],
520-
"columnsTo": [
521-
"id"
522-
],
477+
"columnsFrom": ["event_id"],
478+
"columnsTo": ["id"],
523479
"onDelete": "cascade",
524480
"onUpdate": "no action"
525481
}
@@ -673,12 +629,8 @@
673629
"name": "profiles_image_images_id_fk",
674630
"tableFrom": "profiles",
675631
"tableTo": "images",
676-
"columnsFrom": [
677-
"image"
678-
],
679-
"columnsTo": [
680-
"id"
681-
],
632+
"columnsFrom": ["image"],
633+
"columnsTo": ["id"],
682634
"onDelete": "set null",
683635
"onUpdate": "no action"
684636
}
@@ -788,25 +740,17 @@
788740
"name": "sponsors_square_logo_dark_images_id_fk",
789741
"tableFrom": "sponsors",
790742
"tableTo": "images",
791-
"columnsFrom": [
792-
"square_logo_dark"
793-
],
794-
"columnsTo": [
795-
"id"
796-
],
743+
"columnsFrom": ["square_logo_dark"],
744+
"columnsTo": ["id"],
797745
"onDelete": "set null",
798746
"onUpdate": "no action"
799747
},
800748
"sponsors_square_logo_light_images_id_fk": {
801749
"name": "sponsors_square_logo_light_images_id_fk",
802750
"tableFrom": "sponsors",
803751
"tableTo": "images",
804-
"columnsFrom": [
805-
"square_logo_light"
806-
],
807-
"columnsTo": [
808-
"id"
809-
],
752+
"columnsFrom": ["square_logo_light"],
753+
"columnsTo": ["id"],
810754
"onDelete": "set null",
811755
"onUpdate": "no action"
812756
}
@@ -816,9 +760,7 @@
816760
"sponsors_name_unique": {
817761
"name": "sponsors_name_unique",
818762
"nullsNotDistinct": false,
819-
"columns": [
820-
"name"
821-
]
763+
"columns": ["name"]
822764
}
823765
},
824766
"policies": {},
@@ -861,25 +803,17 @@
861803
"name": "talk_speakers_talk_id_talks_id_fk",
862804
"tableFrom": "talk_speakers",
863805
"tableTo": "talks",
864-
"columnsFrom": [
865-
"talk_id"
866-
],
867-
"columnsTo": [
868-
"id"
869-
],
806+
"columnsFrom": ["talk_id"],
807+
"columnsTo": ["id"],
870808
"onDelete": "cascade",
871809
"onUpdate": "no action"
872810
},
873811
"talk_speakers_speaker_id_profiles_id_fk": {
874812
"name": "talk_speakers_speaker_id_profiles_id_fk",
875813
"tableFrom": "talk_speakers",
876814
"tableTo": "profiles",
877-
"columnsFrom": [
878-
"speaker_id"
879-
],
880-
"columnsTo": [
881-
"id"
882-
],
815+
"columnsFrom": ["speaker_id"],
816+
"columnsTo": ["id"],
883817
"onDelete": "cascade",
884818
"onUpdate": "no action"
885819
}
@@ -940,10 +874,7 @@
940874
"public.profile_type": {
941875
"name": "profile_type",
942876
"schema": "public",
943-
"values": [
944-
"organizer",
945-
"member"
946-
]
877+
"values": ["organizer", "member"]
947878
}
948879
},
949880
"schemas": {},
@@ -956,4 +887,4 @@
956887
"schemas": {},
957888
"tables": {}
958889
}
959-
}
890+
}

website/migrations/meta/_journal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
"breakpoints": true
3232
}
3333
]
34-
}
34+
}

0 commit comments

Comments
 (0)