Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Use GraphQL Batch for find by id fields #23

Merged
merged 1 commit into from Feb 12, 2017
Merged

Use GraphQL Batch for find by id fields #23

merged 1 commit into from Feb 12, 2017

Conversation

cjoudrey
Copy link
Contributor

@cjoudrey cjoudrey commented Feb 11, 2017

First stab at adding batching to simple find by id fields.

@@ -1,8 +1,8 @@
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_key_base: secret-for-development-not-so-secret
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was starting to annoy me. It kept asking me to set an ENV var in dev/test.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

resolve ->(_, args, _) { ::Person.find_by(id: args['id']) }
end

field :person, Graph.find_by_id_field(Graph::Types::Person, ::Person)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👌

class << self
def find_by_id_field(type, model)
GraphQL::Field.define do
type type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSL 👯‍♂️

@cjoudrey cjoudrey merged commit e96e9dc into master Feb 12, 2017
@cjoudrey cjoudrey deleted the graphql-batch branch February 12, 2017 20:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants