Created
December 26, 2017 15:39
-
-
Save thiago-sydow/ae443deab0d67df485a04b42451e020f to your computer and use it in GitHub Desktop.
Files used in the Medium post about Field Instrumentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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