Closed maxlemieux closed 4 years ago
Unique constraint works great. We are still working on conditional display
Unique constraint doesn't work so great on user_name when the user is 'guest'.
This is part of a bigger issue with tracking guest contributions. IP addresses from 'req.ip' are insufficient as a unique identifier since Heroku's internal networking changes IP addresses often.
We need to examine the request object for other sources of truth on the client IP address, perhaps x-forwarded-for?
x-forwarded for works - also our interface doesn't allow for adding a favorite more than once due to conditional display of favorite button. Closing this issue.
Plants favorites saved to mongo can be duplicated.
We need to add a unique constraint in the model file to prevent this.
Also a conditional display of 'Add Favorite' button if it is already a favorite.