Skip to content

Commit

Permalink
Use .trim to compare emails and workaround for checking max_occupancy
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffplays2005 committed Sep 2, 2024
1 parent 70fe97e commit b64dba2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/service-layer/controllers/EventController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class EventController extends Controller {
// Check if the event is full
const reservations = await eventService.getAllReservations(event_id)
if (
fetchedEvent.max_occupancy !== undefined &&
!!fetchedEvent.max_occupancy &&
reservations.length >= fetchedEvent.max_occupancy
) {
this.setStatus(400)
Expand All @@ -33,7 +33,9 @@ export class EventController extends Controller {
// Check if the user is already signed up
if (
reservations.some(
(r) => r.email.toLowerCase() === reservation.email.toLowerCase()
(r) =>
r.email.trim().toLowerCase() ===
reservation.email.trim().toLowerCase()
)
) {
this.setStatus(400)
Expand Down

0 comments on commit b64dba2

Please sign in to comment.