DoSomething / gladiator

:guardsman: The DoSomething.org competitions platform.
2 stars 0 forks source link

Only Allow Users to be In 1 competition per contest. #396

Closed sbsmith86 closed 7 years ago

sbsmith86 commented 7 years ago

FEATURE OVERVIEW

User Story

Only allow a user to be in one competition per contest. Add a check in [UsersController@store](https://github.com/DoSomething/gladiator/blob/master/app/Http/Controllers/Api/UsersController.php#L68) that checks if a user is in a competition for that contest first before adding the user to a waiting room.

If the user is already signed up, return an error response:

{
  "error": {
    "code": 422,
    "message": "User Already In Competition"
  }
}

Additional Information (optional)

We have an api endpoint at POST /users that adds users to a waiting room for a competition. This is used by other apps to add people to competitions.

Currently, a user can only being in a waiting room once. However, if that waiting room gets split into competitions, then they can be added back to the waiting room and therefore can be split into another competition. So it is possible that a user could get into multiple competitions for one contest.

Why This Matters

In phoenix-next, if a user gets prompted to join a competition twice then we only want them to be able to actually join once.