Thanks so much for these resources. I have read through both, but still confused unfortunately (sorry!!). So:
Favourite Button tutorial:
- My users essentially have 2 relationships to stories (a. 1 user can create many stories, b. many users can vote on many stories) - does this mean I have to create a different relationship for each type? ie 2 relationships in this case, one being 1:many and another many:many?
- There is functions for toggle but essentially I have a like and dislike button so I want each to be able to toggle on and off but also to restrict a user to a single option (either like or dislike) and also to a single vote (you can change your mind but its still only counted as one vote)
- Or do I set up 3 relationships a. 1 user can create many stories b. many users can like many stories c. many users can dislike many stories?
- This was really great to know (although a little confusing!) so as soon as I understand the answers to the above questions I will implement the ‘follow’ but change it for the votes
You: Where to store the votes - that depends on what you want. If you don’t want to limit users from voting multiple times, you could just add 2 properties (upvote and downvote) for the story and then increase them
Me: I definitely want to limit users to not only voting once but also only allowing them to like or dislike, not both. So you are saying to either add votes as a property of stories or to create a new votes collection?
Also, is there a way to display percentage? ie what percentage of voters liked the story rather than just count?
Thanks so much for your help Victor!!