Skip to content

Added route to update event information - #100

Merged
rxmox merged 3 commits into
backendfrom
STR-111
Apr 3, 2026
Merged

rxmox merged 3 commits into
backendfrom
STR-111

Conversation

@rodolfo-gp

Copy link
Copy Markdown
Collaborator

Added route to update event information

@rodolfo-gp
rodolfo-gp requested a review from lnqminh3003 April 2, 2026 23:41
@lnqminh3003
lnqminh3003 changed the base branch from main to backend April 3, 2026 00:19
- Remove currentState from allowed update fields to prevent bypassing
  the state machine and missing Pusher real-time events
- Add type and value validation for all fields (null, wrong types,
  empty strings, invalid dates, negative maxParticipant)
- Change route from /update/:eventId to /:eventId to match codebase
  conventions
- Remove duplicate mongoose import
- Sync API documentation with actual error messages and behavior
@rxmox

rxmox commented Apr 3, 2026 •

Copy link
Copy Markdown
Collaborator

changes made

  • Removed currentState from allowed update fields. It bypassed the state machine in updateEventStatus (allowed backward transitions like In Progress to Upcoming) and skipped Pusher real-time events (event-started/event-ended). Status changes should go through PUT /:eventId/status.
  • Added input validation for all fields. Null values and wrong types (e.g. name: null, name: 12345) crashed the server with 500s and leaked internal error messages. Now returns proper 400s. Also validates dates with isNaN(), rejects empty strings for name/description, and checks maxParticipant is a positive integer not below current participant count.
  • Changed route from /update/:eventId to /:eventId to match existing convention (/:eventId/status, /:eventId/leave, etc.)
  • Removed duplicate import mongoose since Types was already imported
  • Synced API docs with actual error messages and behavior

@rxmox
rxmox merged commit 99d4b7a into backend Apr 3, 2026
1 check passed
@rxmox
rxmox deleted the STR-111 branch April 6, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants