Created
August 10, 2019 18:05
-
-
Save github-francisco-pereira/3c97a6e40267ecbba3a4efded419d8b3 to your computer and use it in GitHub Desktop.
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
| const { | |
| GraphQLString, | |
| GraphQLObjectType, | |
| GraphQLBoolean, | |
| GraphQLList, | |
| } = require('graphql'); | |
| const ListingErrorResponseType = require('app/types/listing_error'); | |
| module.exports = new GraphQLObjectType({ | |
| name: 'ListingActionResponseType', | |
| description: 'Response about some action that you do, like activate or change the publication type', | |
| fields: { | |
| message: { | |
| type: GraphQLString, | |
| description: 'Only for compatibility', | |
| deprecationReason: 'Listing actions response needs to be more complex than a single message', | |
| resolve({ data }) { | |
| return data.message; | |
| }, | |
| }, | |
| success: { | |
| type: GraphQLBoolean, | |
| description: 'Indicates if have success', | |
| resolve({ data }) { | |
| return data.success; | |
| }, | |
| }, | |
| errors: { | |
| type: new GraphQLList(ListingErrorResponseType), | |
| description: 'List of errors', | |
| resolve({ data }) { | |
| return data.errors; | |
| }, | |
| }, | |
| }, | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment