Links and Voting

Attaching Users to Links

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!):

send a mutation to the server

Neat!

Adding Votes

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:

vote for the first link

Relating Links and Votes

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:

fetch the list of votes

To close this chapter, make a query for all the links and see how smoothly the votes become available:

make a query for all the links and see how smoothly the votes become available

Yay!

Unlock the next chapter
In which Python class are the arguments for a Mutation defined?
Arguments
Query
Mutation
Schema