hgzimmerman / FullstackRustDemo

Novelty website + bucket questions implementation.
MIT License
41 stars 5 forks source link

Implement upvotes and downvotes for the forum system #82

Open hgzimmerman opened 6 years ago

hgzimmerman commented 6 years ago

This will require 2 separate junction tables, one for upvotesand one for downvotes.

The junction will be useruuid + postuuid. When upvoting or downvoting the uuid belonging to the user that initiated the action will be added to the respective junction table. When calculating the votes, just use the count diesel DSL method. The belongingTo/groupBy diesel DSL will make it efficient to get these for multiple posts at once.

Return both the upvotes and downvotes and let the client determine how to display an aggregate.