diff options
| author | mo khan <mo.m.khan@shopify.com> | 2020-12-23 15:05:00 -0700 |
|---|---|---|
| committer | mo khan <mo.m.khan@shopify.com> | 2020-12-23 15:05:00 -0700 |
| commit | 35f62884ceee77fa28bec0533e0f3bb15336e941 (patch) | |
| tree | 84787779650e0437107fa41052cef1eb503ae4e3 | |
| parent | b8670e1826f05b38e6b2405d0ca916573de43284 (diff) | |
chore: move types to separate files
| -rw-r--r-- | lib/server.rb | 16 | ||||
| -rw-r--r-- | lib/types/cake.rb | 5 | ||||
| -rw-r--r-- | lib/types/query.rb | 10 |
3 files changed, 17 insertions, 14 deletions
diff --git a/lib/server.rb b/lib/server.rb index ad3580b..30b645a 100644 --- a/lib/server.rb +++ b/lib/server.rb @@ -2,20 +2,8 @@ require 'rack' require 'json' require 'graphql' -module Types - class Cake < GraphQL::Schema::Object - field :name, String, null: false - end - - class Query < GraphQL::Schema::Object - field :me, String, null: false - field :cakes, [Cake], null: false - - def me - 'mo' - end - end -end +require 'types/cake' +require 'types/query' class MySchema < GraphQL::Schema max_complexity 400 diff --git a/lib/types/cake.rb b/lib/types/cake.rb new file mode 100644 index 0000000..94f3240 --- /dev/null +++ b/lib/types/cake.rb @@ -0,0 +1,5 @@ +module Types + class Cake < GraphQL::Schema::Object + field :name, String, null: false + end +end diff --git a/lib/types/query.rb b/lib/types/query.rb new file mode 100644 index 0000000..253f5d7 --- /dev/null +++ b/lib/types/query.rb @@ -0,0 +1,10 @@ +module Types + class Query < GraphQL::Schema::Object + field :me, String, null: false + field :cakes, [Cake], null: false + + def me + 'mo' + end + end +end |
