-
Notifications
You must be signed in to change notification settings - Fork 1
Implement Functionality to Submit Event Requests #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cejiogu
wants to merge
31
commits into
master
Choose a base branch
from
chimdi/event-form
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
…agger documentation
…s for handling form submissions
…e for printers table
…en row in the event_forms table
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
In this pull request, I introduce in-house event form submission and moderation functionality to Navi, creating the backend logic needed to enable users to submit requests to host events directly through the app. These event requests are persisted in the backend on the SQLite database, and moderated by an approval workflow. The goal is to replace the need for external tools (e.g. Google Forms) with a fully integrated backend solution, and to facilitate real-time updates to both submitters and administrators.
Changes Made
Change 1: Introduce event form persistence via database migrations
I added a new migration to introduce an event_forms table, which stores event submission metadata including:
netid)Change 2: Implement REST endpoints for event submission and retrieval
I added REST endpoints and a corresponding controller to support the full event submission lifecycle:
POST /events/create-eventto submit a new event requestGET /eventsto retrieve all submissions (admin-facing, includes public and private information)GET /events/approvedto retrieve all approved events (public-facing, sanitized output)PUT /events/:idto approve or reject a submission (admin-only)Swagger documentation was updated to reflect all new endpoints and request/response schemas.
Change 3: Add real-time updates using WebSockets (Socket.IO)
To facilitate real-time, bi-directional communication between server and client(s), I integrated WebSockets using the JavaScript Socket.io library to push updates to clients in real time:
Room-based routing is used to scope messages appropriately:
publicroom for approved eventsadminroom for relevant moderation eventsnetid:<netid>) for personalized notifications, particularly when submitted events are rejectedI introduced a
toPublicEventhelper to ensure that only public-safe fields are sent to non-admin clients. Internal identifiers and metadata (e.g. database IDs and timestamps) are excluded from public payloads, reducing frontend coupling to database schema.Change 4: Migration adjustments
I added a migration to remove a
UNIQUEconstraint from theprinters.locationcolumn via a safe table-recreation migration, done to reflect real-world usage where multiple printers may exist at the same location. Additionally, I implemented a trigger on theevent_formstable to automatically update theupdated_atattribute of a given record upon data change.Test Coverage
I manually tested the feature end-to-end using a combination of REST requests and WebSocket clients via multiple terminals.
POST /events/create-eventcorrectly inserts a record into the databasecurlto approve and reject events viaPUT /events/:id, confirming that:approval_statusfield updates correctlyNext Steps
event_attachmentstable