BGWE / BoardgameWE

Backend of the Board Game Componion application.
MIT License
2 stars 0 forks source link

Check board game existence when adding to library #255

Closed FServais closed 4 years ago

FServais commented 4 years ago

When using POST /user/current/library_games, board game id is added to user's library without check.

@waliens, should we check or it doesn't matter?

waliens commented 4 years ago

It shouldn't be possible to add a non-existing board game to a library or any other association (e.g event) because there is a foreign key constraint in the database. Were you able to add such a board game to a library ? If so, it is a bug and I need to investigate.

FServais commented 4 years ago

It was when writing a test, I got a 200 but haven't checked if it was recorded in DB. I'll investigate more and let you know :)

FServais commented 4 years ago

Indeed, the relation was successfully added to the table 🤔

FServais commented 4 years ago

I see the constraints on local or prod, not on testing env. Checking where is the difference...

FServais commented 4 years ago

Found the bug in the test script!