Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 11, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/c39344c524d9c6d2b71440eb983f42dd to your computer and use it in GitHub Desktop.
Save velotiotech/c39344c524d9c6d2b71440eb983f42dd to your computer and use it in GitHub Desktop.
defmodule GraphqlWeb.Schema do
use Absinthe.Schema
import_types(GraphqlWeb.Schema.Types)
query do
mutation do
field :create_post, type: :blog_post do
arg(:title, non_null(:string))
arg(:body, non_null(:string))
arg(:accounts_user_id, non_null(:id))
resolve(&Graphql.Blog.PostResolver.create/2)
end
field :update_post, type: :blog_post do
arg(:id, non_null(:id))
arg(:post, :update_post_params)
resolve(&Graphql.Blog.PostResolver.update/2)
end
field :delete_post, type: :blog_post do
arg(:id, non_null(:id))
resolve(&Graphql.Blog.PostResolver.delete/2)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment