JoeKennedy / fantasy

A Fantasy League Of Ice And Fire
6 stars 0 forks source link

Make team and player URLs unique within league #1

Closed JoeKennedy closed 8 years ago

JoeKennedy commented 8 years ago

The TODO is here: https://github.com/JoeKennedy/fantasy/blob/master/Foundation.hs#L125

Two options here:

  1. For player routes, use characterId instead of playerId and for team routes, use (and, first, add) teamNumber for team routes instead of teamId.
  2. In inAuthorized for team and player routes, require that the teamId and playerId, respectively, are in the league.

I'd prefer the first option, because it'll shorten the urls for each, so it'll produce /leagues/50/players/110 instead of /leagues/50/players/2345. However, you'll have to change all the routes to take the new parameter, and lookup the relevant entities using getBy404 rather than get404.

JoeKennedy commented 8 years ago

As a note, I'm going with the first option discussed in my opening comment.