Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 11, 2020 07:35
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/dc1fed4d21e383e4a7203df36060e18f to your computer and use it in GitHub Desktop.
Save velotiotech/dc1fed4d21e383e4a7203df36060e18f to your computer and use it in GitHub Desktop.
defmodule GraphqlWeb.Schema do
use Absinthe.Schema
import_types(GraphqlWeb.Schema.Types)
query do
field :blog_posts, list_of(:blog_post) do
resolve(&Graphql.Blog.PostResolver.all/2)
end
field :blog_post, type: :blog_post do
arg(:id, non_null(:id))
resolve(&Graphql.Blog.PostResolver.find/2)
end
field :accounts_users, list_of(:accounts_user) do
resolve(&Graphql.Accounts.UserResolver.all/2)
end
field :accounts_user, :accounts_user do
arg(:email, non_null(:string))
resolve(&Graphql.Accounts.UserResolver.find/2)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment