Skip to content

Instantly share code, notes, and snippets.

@malgamves
Last active May 5, 2019 10:34
Show Gist options
  • Save malgamves/eaac3553d7dec9b598e5b180a4798c3e to your computer and use it in GitHub Desktop.
Save malgamves/eaac3553d7dec9b598e5b180a4798c3e to your computer and use it in GitHub Desktop.
import gql from 'graphql-tag'
export const ADD_VOTE_MUTATION = gql`
mutation updateVotes($id: Int!) {
update_characters(where: {id: {_eq: $id}},
_inc: {votes: 1}) {
affected_rows
}
}
`;
export const ALL_CHAR_QUERY = gql`
query characters {
characters(order_by: {id: asc}) {
id
name
}
}
`;
export const ALL_VOTES_SUBSCRIPTION = gql`
subscription allVotes{
CharacterDeathVotes : characters(order_by: {id: asc}) {
label: name
data: votes
}
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment