Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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