Add saveInAddressBook mutation#83
Merged
AlessioRocco merged 6 commits intomasterfrom Mar 13, 2020
Merged
Conversation
58cd1db to
e76d970
Compare
b3766a3 to
aceba5e
Compare
Closed
3 tasks
2993217 to
9a811f5
Compare
9a811f5 to
a32ef01
Compare
This type is used to presents errors as data as suggested in the graphql-ruby documentation: https://graphql-ruby.org/mutations/mutation_errors.html#errors-as-data
This input object is used for every mutation that needs an address as input. To notice that for the country_id and state_id arguments the auto loading was used: https://graphql-ruby.org/mutations/mutation_classes.html#auto-loading-arguments
This raises a graphql-friendly error with the message from the CanCan::AccessDenied exception message.
The added helper method are: - current_user - current_ability - user_errors The 'current_user' and 'current_ability' delegates to the context, 'user_errors' is used to return 'errors as data' as described in the documentation: https://graphql-ruby.org/mutations/mutation_errors.html#errors-as-data
The mutation accepts an address and a boolean named default as inputs and saves the address to the current user address book. If the default argument is true, the address will be the default one used during the checkout.
Using command "bundle exec rake schema:idl"
a32ef01 to
885ff42
Compare
ChristianRimondi
approved these changes
Mar 13, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mutation accepts an address and a boolean named default as inputs
and saves the address to the current user address book. If the default
argument is true, the address will be the default one used during the
checkout.