With sign in power, you can now create your own links, posted by you. To make it possible, let’s integrate the Links and Users models:
To test it, send a mutation to the server (remember to use the token!):
Neat!
One of the Hackernews’ features is to vote on links, making ones more popular than others. To create this, you’ll need to create a Vote model and a CreateVote
mutation. Let’s begin:
Voting time! Try to vote for the first link:
You can already vote, but you can’t see it! A solution for this is being able to get a list of all the votes and a list of votes from each link. Follow the next steps to accomplish it:
Awesome! On Insomnia, try to fetch the list of votes:
To close this chapter, make a query for all the links and see how smoothly the votes become available:
Yay!