Links and Voting

Attaching Users to Links

With sign in power, you can now create you 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!

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:

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 GraphiQL, 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!

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