Describe the bug
With the new system including usernames in the booklist table in the database, the current Primary Key of just the ISBN number will prevent multiple users from saving the same book
To Reproduce
Steps to reproduce the behavior:
Add a book as one user
"Sign in" with a different name
Try to add the same book to the list with the new name
See that this is unsuccessful
Expected behavior
When a user attempts to add a book to their list that is not already associated with their username, they should be able to do so.
Additional contextNote: users would still be unable to add the same book twice. This means that, when adding a book, we should first query the database to see if a book with that isbn and username is already stored, and if so return a helpful error message.
Create a composite Primary Key which takes as its values the ISBN and the Username. Info on how to modify the database in this StackOverflow discussion.
Describe the bug With the new system including usernames in the
booklist
table in the database, the current Primary Key of just the ISBN number will prevent multiple users from saving the same bookTo Reproduce Steps to reproduce the behavior:
Expected behavior When a user attempts to add a book to their list that is not already associated with their username, they should be able to do so.
Additional context Note: users would still be unable to add the same book twice. This means that, when adding a book, we should first query the database to see if a book with that isbn and username is already stored, and if so return a helpful error message.