Skip to content

Instantly share code, notes, and snippets.

@benwilson512
Created January 10, 2017 23:38
Show Gist options
  • Save benwilson512/2887f63b6ff98c1dcd9816e26637930f to your computer and use it in GitHub Desktop.
Save benwilson512/2887f63b6ff98c1dcd9816e26637930f to your computer and use it in GitHub Desktop.
mutation do
field :submit_comment, :comment do
arg :repo_fullname, non_null(:string)
arg :content, non_null(:string)
resolve fn args, _ ->
comment = # create comment
{:ok, comment}
end
end
end
subscription do
field :comment_added, :comment do
arg :repo_fullname, non_null(:string)
trigger :submit_comment do
# filter fn comment, args ->
# comment.repository_name == args.repo_fullname
# end
subscription_key fn args ->
args.repo_fullname
end
mutation_key fn comment ->
comment.repository_name
end
end
resolve fn message, _, _ ->
{:ok, message}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment