Skip to content

Instantly share code, notes, and snippets.

@thiago-sydow
Created December 26, 2017 15:39
Show Gist options
  • Save thiago-sydow/ae443deab0d67df485a04b42451e020f to your computer and use it in GitHub Desktop.
Save thiago-sydow/ae443deab0d67df485a04b42451e020f to your computer and use it in GitHub Desktop.
Files used in the Medium post about Field Instrumentation
QueryType = GraphQL::ObjectType.define do
name "Query"
description "The root query for the Impraise GraphQL Schema"
field :organization do
type OrganizationType
description "Lookup an `Organization` by id"
access_permission(policy_class: OrganizationsPolicy, action: :load?)
argument :id, !types.Int, "Organization id"
resolve ->(_obj, args, ctx) {
Organization.find(args[:id])
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment