check userAccess at the beginning of the method, and add the access-denied messages for other endpoints
removed ShoppingCart's user attribute. This wasn't being used, and seemed to complicate saving in the repository.
fix to connect user and shoppingcart, rather than creating a new shoppingcart each time
this means a user can login, add books, logout, and re-login to get the existing cart
implemented an initial usersession that saves in the database
the previous loggedInUserRepository caused issues with deleting all the created users (creating user1 and user2, then logging in/out of user1 ends up deleting user2 completely). This PR fixes that issue at least.
this allows user1 to login/logout, then user2 to login/logout, and for user1 to login/logout again later.
Note, this is NOT a final solution. Ideally we should use cookies, so that each browser can have independent sessions at the same time. This will be addressed with https://github.com/waheebh1/online-bookstore/issues/43
Changes:
userAccess
at the beginning of the method, and add theaccess-denied
messages for other endpointsShoppingCart
'suser
attribute. This wasn't being used, and seemed to complicate saving in the repository.user
andshoppingcart
, rather than creating a new shoppingcart each timeusersession
that saves in the databaseloggedInUserRepository
caused issues with deleting all the created users (creating user1 and user2, then logging in/out of user1 ends up deleting user2 completely). This PR fixes that issue at least.cookies
, so that each browser can have independent sessions at the same time. This will be addressed with https://github.com/waheebh1/online-bookstore/issues/43