Hi everyone,
I'm working on a review system for my app using Appwrite, and I'm facing an issue with ensuring that a user can only leave one review per product. I have a Products collection where I store the product details and a Reviews collection where users can submit their reviews. The Reviews collection has fields like userId, productId, and stars. I’ve set up a relation between the Products collection and the Reviews collection, and I’ve also implemented user authentication so users can log in.
However, I’m having trouble preventing a user from submitting multiple reviews for the same product. The permissions system seems to be the main issue, especially since I can’t use an index due to the relation between the Products and Reviews collections. I also experimented with linking users to a separate collection, but that approach doesn’t work well with the user authentication system.
Can anyone suggest the best approach to make sure that a user can only leave one review per product? I’m especially looking for a solution that integrates smoothly with Appwrite’s permissions system and user authentication. Any help or advice would be much appreciated!