Closing day 1 event registrations - #63
Conversation
|
@Akshat-Raj is attempting to deploy a commit to the Genesis' projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR closes registrations for selected Day 1 events by removing them from the public registration UI and rejecting attempts via the registration API.
Changes:
- Hid “Ideathon” (
pitch_perfect) and “Technoseek” from the public registration event list. - Updated the
/api/registerPOST handler to reject registrations forclash_royale,pitch_perfect, andtechnoseek.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/app/register/page.tsx | Removes closed events from the UI by commenting out their ALL_EVENTS entries. |
| src/app/api/register/route.ts | Blocks registrations for the closed event IDs with a 400 error response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (event === "clash_royale" || event === "pitch_perfect" || event === "technoseek") { | ||
| return NextResponse.json({ error: "Registrations for Clash Royale, Ideathon, and Technoseek are closed." }, { status: 400 }); |
There was a problem hiding this comment.
The closed-registration response always lists multiple events ("Clash Royale, Ideathon, and Technoseek") even when the user attempted to register for only one of them, which can be confusing. Consider returning an event-specific message (e.g., derive the display name from EVENT_NAMES / EVENT_LABELS based on the requested event) while still keeping the status code 400.
| const body = await req.json(); | ||
| const { event, team_name, member1, member2, member3 } = body; | ||
|
|
||
| if (event === "clash_royale") { | ||
| return NextResponse.json({ error: "Registrations for Clash Royale are closed." }, { status: 400 }); | ||
| if (event === "clash_royale" || event === "pitch_perfect" || event === "technoseek") { | ||
| return NextResponse.json({ error: "Registrations for Clash Royale, Ideathon, and Technoseek are closed." }, { status: 400 }); | ||
| } |
There was a problem hiding this comment.
The API currently only checks for presence of event, but does not validate that it is a supported event ID (or even a string). For unknown/invalid values, this will fall through to Participant.create() and rely on Mongoose enum validation, which turns a client input error into a 500. Consider normalizing (String(event).trim()) and validating against a single source of truth (e.g., EVENT_IDS from src/lib/formConstants.ts or the Participant enum) and returning a 400 for invalid events before the closed-events check.
No description provided.