diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 5918193..b46f9f8 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,2 +1,4 @@ //= link_tree ../images //= link_directory ../stylesheets .css +//= link graphiql/rails/application.css +//= link graphiql/rails/application.js diff --git a/app/graphql/types/link_type.rb b/app/graphql/types/link_type.rb new file mode 100644 index 0000000..5941c2d --- /dev/null +++ b/app/graphql/types/link_type.rb @@ -0,0 +1,7 @@ +module Types + class LinkType < Types::BaseObject + field :id, ID, null: false + field :url, String, null: false + field :description, String, null: false + end +end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 46fa7de..dc56a75 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -1,13 +1,12 @@ module Types - class QueryType < Types::BaseObject - # Add root-level fields here. - # They will be entry points for queries on your schema. + class QueryType < BaseObject + # queries are just represented as fields + # `all_links` is automatically camelcased to `allLinks` + field :all_links, [LinkType], null: false - # TODO: remove me - field :test_field, String, null: false, - description: "An example field added by the generator" - def test_field - "Hello World!" + # this method is invoked, when `all_link` fields is being resolved + def all_links + Link.all end end end