Skip to content

Commit

Permalink
fix: queries
Browse files Browse the repository at this point in the history
  • Loading branch information
rustamch committed Apr 1, 2024
1 parent 663f1b3 commit e9e2b17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions store/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ func (s *pgEventStore) RegisterVolunteer(ctx context.Context, eventID int, volun
}

if registered >= event.VolunteersRequired {
_, err := tx.ExecContext(ctx, "INSERT INTO event_signups (event_id, volunteer_id) VALUES ($1, $2)", eventID, volunteerID)
_, err := tx.ExecContext(ctx, "INSERT INTO event_signups (event_id, user_id) VALUES ($1, $2)", eventID, volunteerID)
if err != nil {
tx.Rollback()
return fmt.Errorf("unable to register volunteer for standby with id %d, error %w", eventID, err)
}
return tx.Commit()
}

_, err = tx.ExecContext(ctx, "INSERT INTO event_signups (event_id, volunteer_id) VALUES ($1, $2)", eventID, volunteerID)
_, err = tx.ExecContext(ctx, "INSERT INTO event_signups (event_id, user_id) VALUES ($1, $2)", eventID, volunteerID)
if err != nil {
tx.Rollback()
return fmt.Errorf("unable to register volunteer with id %d, error %w", eventID, err)
Expand Down

0 comments on commit e9e2b17

Please sign in to comment.