Exemplo n.º 1
0
 fields: () => baseFields({
     id: relay.globalIdField('Committee'),
     name: { type: graphql.GraphQLString },
     description: { type: graphql.GraphQLString },
     members: {
         type: relay.connectionDefinitions({
             name: 'User',
             nodeType: UserType.User,
         }).connectionType,
         description: 'A committee members',
         args: relay.connectionArgs,
         resolve: (committee, args) =>
             relay.connectionFromPromisedArray(committee.findMembers(), args),
     },
     posts: {
         type: PostType.PostConnection,
         description: 'A committee posts',
         args: relay.connectionArgs,
         resolve: (committee, args) =>
             relay.connectionFromPromisedArray(committee.findPosts(), args),
     },
     events: {
         type: relay.connectionDefinitions({
             name: 'Event',
             nodeType: EventType.Event,
         }).connectionType,
         description: 'A committee events',
         args: relay.connectionArgs,
         resolve: (committee, args) =>
             relay.connectionFromPromisedArray(committee.findEvents(), args),
     },
 }),
Exemplo n.º 2
0
 (clientSchema) => {
   const objectType = generateObjectType(clientSchema, NodeInterfaceType)
   const { connectionType, edgeType } = connectionDefinitions({
     name: clientSchema.modelName,
     nodeType: objectType,
     connectionFields: () => ({
       totalCount: {
         type: GraphQLInt,
         resolve: (conn) => conn.totalCount
       }
     })
   })
   const createMutationInputArguments = generateCreateObjectMutationInputArguments(clientSchema)
   const updateMutationInputArguments = generateUpdateObjectMutationInputArguments(clientSchema)
   const queryFilterInputArguments = generateQueryFilterInputArguments(clientSchema)
   const uniqueQueryInputArguments = generateUniqueQueryInputArguments(clientSchema)
   clientSchema = patchRelations(clientSchema)
   return {
     clientSchema,
     objectType,
     connectionType,
     edgeType,
     createMutationInputArguments,
     updateMutationInputArguments,
     queryFilterInputArguments,
     uniqueQueryInputArguments
   }
 },
Exemplo n.º 3
0
export default function (nodeInterface) {
	const nodeType = new GraphQLObjectType({
	  name: 'Address',
	  fields: {
	  	id: globalIdField('Address'),
			userId: {
				type: GraphQLString,
				resolve: (obj) => toGlobalId('User', obj.user_id)
			},
			postalCode: {
				type: GraphQLString,
				resolve: (obj) => obj.postal_code
			},
			address: {
				type: GraphQLString,
				resolve: (obj) => obj.address
			},
			unitNumber: {
				type: GraphQLString,
				resolve: (obj) => obj.unit_number
			},
			contact: {
				type: GraphQLString,
				resolve: (obj) => obj.contact_no
			}
	  },
	  interfaces: [nodeInterface]
	});

	return {
		nodeType,
		...connectionDefinitions({nodeType})
	}
}
Exemplo n.º 4
0
  fields: function() {
    return {
      id: GraphQLRelay.globalIdField('User'),
      name: {
        type: GraphQL.GraphQLString,
        description: 'The name of the user',
      },

      // We can set up a relationship between users and conferences here
      conferences: {
        description: 'A listing of the user\'s conferences',

        // Relay gives us helper functions to define the Connection and its args
        type: GraphQLRelay.connectionDefinitions({name: 'Conference', nodeType: conferenceType}).connectionType,
        args: {
          // argument to tell GraphQL which user to pass back
          // in the resolve block
          userToShow: {type: GraphQL.GraphQLInt}
        },

        // The resolve block will complete a query and pass back
        // data for the user id supplied by the arguments we pass in
        resolve: function(user, args) {

          return GraphQLRelay.connectionFromArray(db.getConferencesByUser(args.userToShow), args)
        },
      }
    }
  },
Exemplo n.º 5
0
export default function (nodeInterface) {
	const nodeType = new GraphQLObjectType({
	  name: 'CreditCard',
	  fields: {
	  	id: globalIdField('CreditCard'),
			brand: {
				type: GraphQLString,
				resolve: (obj) => obj.brand
			},
			name: {
				type: GraphQLString,
				resolve: (obj) => obj.name
			},
			asteriskNumber: {
				type: GraphQLString,
				resolve: (obj) => `xxxx xxxx xxxx ${obj.last4.slice(0, 4)}`
			},
			expireOn: {
				type: GraphQLString,
				resolve: (obj) => `${obj.exp_month}/${obj.exp_year}`
			}
		},
	  interfaces: [nodeInterface]
	});

	return {
		nodeType,
		...connectionDefinitions({nodeType})
	};
}
Exemplo n.º 6
0
const addConnectionType = (allTypes: Object, name: string) => {
  const { connectionType, edgeType } = connectionDefinitions({
    name,
    nodeType: allTypes[name],
  });
  allTypes[`${name}Connection`] = connectionType;
  allTypes[`${name}Edge`] = edgeType;
};
Exemplo n.º 7
0
const Schema = (db) => {

  let storeType = new GraphQLObjectType({
    name: 'Store',
    fields: () => ({
      linkConnection: {
        type: linkConnection.connectionType,
        args: connectionArgs,
        resolve: (_, args) => connectionFromPromisedArray(
          db.collection("links").find({}).toArray(),
          args
        )
      },
    })
  })

  let linkType = new GraphQLObjectType({
    name: 'Link',
    fields: () => ({
      id: {
        type: new GraphQLNonNull(GraphQLID),
        resolve: (obj) => obj._id
      },
      title: { type: GraphQLString  },
      url: { type: GraphQLString  },
    })
  });

  let linkConnection = connectionDefinitions({
    name: 'Link',
    nodeType: linkType
  });

  const schema = new GraphQLSchema({
    query: new GraphQLObjectType({
      name: 'Query',
      fields: () => ({
        store: {
          type: storeType,
          resolve: () => store
        }
      })
    }),

    mutation: new GraphQLObjectType({
      name: 'Mutation',
      fields: () => ({
        incrementCounter: {
          type: GraphQLInt,
          resolve: () => this.counter
        }
      })
    })
  });
  return schema;
}
Exemplo n.º 8
0
export default function (nodeInterface, {GraphQLUserRef}) {
	const nodeType = new GraphQLObjectType({
	  name: 'CreditRecord',
	  fields: {
	  	id: globalIdField('CreditRecord'),
			amount: {
				type: GraphQLFloat,
				resolve: (obj) => obj.amount
			},
			paymentRefNo: {
				type: GraphQLString,
				resolve: (obj) => obj.paypal_ref_no
			},
			topUp: {
				type: GraphQLBoolean,
				resolve: (obj) => obj.top_up
			},
			createdAt: {
				type: GraphQLString,
				resolve: (obj) => obj.created_on&&toDisplayDate(obj.created_on, true)
			},
			paymentMode: {
				type: GraphQLString,
				resolve: (obj) => obj.payment_mode
			},
			status: {
				type: GraphQLInt,
				resolve: (obj) => obj.status
			},
			approvedAt: {
				type: GraphQLString,
				resolve: (obj) => obj.approved_on&&toDisplayDate(obj.approved_on)
			},
			approvedBy: {
				type: GraphQLString,
				resolve: (obj) => obj.approved_by
			},
			description: {
				type: GraphQLBoolean,
				resolve: (obj) => obj.remarks
			},
			user: {
				type: GraphQLUserRef,
				resolve: (obj) => Users.findById(obj.user_id)
			}
	  },
	  interfaces: [nodeInterface]
	});

	return {
		nodeType,
		...connectionDefinitions({nodeType})
	};
}
Exemplo n.º 9
0
  .reduce((acc, key) => {
    acc[key] = refCreators[key](acc);
    const { connectionType, edgeType } = connectionDefinitions({
      name: acc[key].name,
      nodeType: acc[key],
    });

    acc[key + 'Connection'] = connectionType;
    acc[key + 'Edge'] = edgeType;

    return acc;
  }, { nodeInterface, nodeField });
Exemplo n.º 10
0
export function createConnection({
  name,
  nodeType,
  target: targetMaybeThunk,
  orderBy: orderByEnum,
  before,
  after,
  connectionFields,
  edgeFields,
  where
}) {
  const {
    edgeType,
    connectionType
  } = connectionDefinitions({
    name,
    nodeType,
    connectionFields,
    edgeFields
  });

  let $connectionArgs = {
    ...connectionArgs
  };

  if (orderByEnum) {
    $connectionArgs.orderBy = {
      type: new GraphQLList(orderByEnum)
    };
  }

  const {
    resolveEdge,
    resolveConnection
  } = createConnectionResolver({
    orderBy: orderByEnum,
    target: targetMaybeThunk,
    before,
    after,
    where,
    ignoreArgs: $connectionArgs
  });

  return {
    connectionType,
    edgeType,
    nodeType,
    resolveEdge,
    resolveConnection,
    connectionArgs: $connectionArgs,
    resolve: resolveConnection
  };
}
Exemplo n.º 11
0
function UsersConnection(name, connType) {
    var {connectionType} = connectionDefinitions({
        name: name,
        nodeType: connType
    });
    return {
        type: connectionType,
        args: connectionArgs,
        resolve: (_, args) => {
            var promiseResults = User.getListOfUsers();
            console.log("connection results: " + promiseResults);
            return connectionFromPromisedArray(promiseResults, args)
        }
};
}
const getConnection = (name) => {
  if (!connectionTypes[name]) {
    connectionTypes[name] = connectionDefinitions({
      name,
      nodeType: getType(name),
      connectionFields: {
        totalCount: {
          type: GraphQLInt,
          description: 'Total number of items',
          resolve: connection => connection.totalCount,
        },
      },
    }).connectionType;
  }
  return connectionTypes[name];
};
Exemplo n.º 13
0
const Schema = (db) => {
  // 注意下面的 name 改变了
  const linkType = new GraphQLObjectType({
    name: 'Link',
    fields: () => ({
      id: { // 注意之前的_id变为此处的id, 并在 resolve 里 return _id
        type: new GraphQLNonNull(GraphQLID),
        resolve: (obj) => obj._id,
      },
      title: { type: GraphQLString },
      url: { type: GraphQLString },
    }),
  });

  const linkConnection = connectionDefinitions({
    name: 'Link',
    nodeType: linkType,
  });

  const store = {};
  // 注意下面的name,如果跟已有的同名的话, 会出现不报任何错误但server启动不起来的状况
  const storeType = new GraphQLObjectType({
    name: 'Store',
    fields: () => ({
      linkConnection: {
        type: linkConnection.connectionType,
        args: connectionArgs,
        resolve: (_, args) => connectionFromPromisedArray(db.collection('links').find({}).toArray(), args),
      },
    }),
  });

  const schema = new GraphQLSchema({
    query: new GraphQLObjectType({
      name: 'Query',
      fields: () => ({
        store: {
          type: storeType,
          resolve: () => store,
        },
      }),
    }),
  });

  return schema;
};
Exemplo n.º 14
0
export function betterConnectionDefinitons({
  name,
  nodeType,
  connectionFields = {},
}) {
  return connectionDefinitions({
    name,
    nodeType,
    connectionFields: () => ({
      totalCount: {
        type: GraphQLInt,
        resolve: (conn) => conn.totalCount,
        description: 'count of total number of objects in connection, ignoring pagination',
      },
      ...connectionFields,
    }),
  });
}
Exemplo n.º 15
0
      const typeFields = reduce(fields, (typeFields, field, fieldName) => {
        if (field.args === connectionArgs) {
          // It's a connection
          const connectionName = getTypeFieldName(typeName, fieldName);
          const {connectionType} = connectionDefinitions({
            name: connectionName,
            nodeType: types[field.type],
            connectionFields: {
              count: {
                name: 'count',
                type: GraphQLFloat
              }
            }
          });
          field.type = connectionType;
        } else {
          // It's an object reference
          field.type = types[field.type];
        }

        // deeply find the path of the field we want to resolve the reference of
        const path = fieldName.split('.');
        const newTypeFields = {...typeFields};
        let parent = newTypeFields;
        let segment;

        while (path.length > 0) {
          segment = path.shift();

          if (parent[segment]) {
            if (parent[segment].type instanceof GraphQLObjectType) {
              parent = parent[segment].type.getFields();
            } else if (parent[segment].type instanceof GraphQLList &&
               parent[segment].type.ofType instanceof GraphQLObjectType) {
              parent = getTypeFields(parent[segment].type.ofType);
            }
          }
        }

        if (path.length === 0) {
          parent[segment] = field;
        }
        return newTypeFields;
      }, getTypeFields(type));
Exemplo n.º 16
0
/**
 * Creates a connection that will return all objects of the given
 * `swapiType`; the connection will be named using `name`.
 */
function rootConnection(name, swapiType) {
  var graphqlType = swapiTypeToGraphQLType(swapiType);
  var {connectionType} = connectionDefinitions({
    name: name,
    nodeType: graphqlType,
    connectionFields: () => ({
      totalCount: {
        type: GraphQLInt,
        resolve: (conn) => conn.totalCount,
        description:
`A count of the total number of objects in this connection, ignoring pagination.
This allows a client to fetch the first five objects by passing "5" as the
argument to "first", then fetch the total count so it could display "5 of 83",
for example.`
      },
      [swapiType]: {
        type: new GraphQLList(graphqlType),
        resolve: (conn) => conn.edges.map((edge) => edge.node),
        description:
`A list of all of the objects returned in the connection. This is a convenience
field provided for quickly exploring the API; rather than querying for
"{ edges { node } }" when no edge data is needed, this field can be be used
instead. Note that when clients like Relay need to fetch the "cursor" field on
the edge to enable efficient pagination, this shortcut cannot be used, and the
full "{ edges { node } }" version should be used instead.`
      }
    }),
  });
  return {
    type: connectionType,
    args: connectionArgs,
    resolve: async (_, args) => {
      var {objects, totalCount} = await getObjectsByType(swapiType, args);
      return {
        ...connectionFromArray(objects, args),
        totalCount: totalCount
      };
    }
  };
}
Exemplo n.º 17
0
export default function (nodeInterface) {
	const nodeType = new GraphQLObjectType({
	  name: 'Category',
	  fields: {
	  	id: globalIdField('Category'),
			nameCn: {
				type: new GraphQLNonNull(GraphQLString),
				resolve: (obj) => obj.name_ch
			},
			nameEn: {
				type: new GraphQLNonNull(GraphQLString),
				resolve: (obj) => obj.name_en
			}
	  },
	  interfaces: [nodeInterface]
	});

	return {
		nodeType,
		...connectionDefinitions({nodeType})
	};
}
Exemplo n.º 18
0
export default function (nodeInterface, {GraphQLUser}) {
  const nodeType = new GraphQLObjectType({
    name: 'Feedback',
    fields: {
      id: globalIdField('Feedback'),
      userId: {
        type: GraphQLString,
        resolve: (obj) => toGlobalId('User', obj.user_id)
      },
      rating: {
        type: GraphQLFloat,
        resolve: (obj) => obj.rating
      },
      comment: {
        type: GraphQLString,
        resolve: (obj) => obj.comment
      },
      createdAt: {
        type: GraphQLString,
        resolve: (obj) => toDisplayDate(obj.created)
      },
      user: {
        type: GraphQLUser,
        resolve: (obj) => {
          if (!obj.user_id) return null;

          return Users.findById(obj.user_id);
        }
      }
    },
    interfaces: [nodeInterface]
  });

  return {
    nodeType,
    ...connectionDefinitions({nodeType})
  };
}
Exemplo n.º 19
0
export default function (nodeInterface) {
	const nodeType = new GraphQLObjectType({
	  name: 'Worker',
	  fields: {
	  	id: globalIdField('Worker'),
	  	email: {
	  		type: GraphQLString,
	  		resolve: (obj) => obj.email
	  	},
			firstName: {
				type: GraphQLString,
				resolve: (obj) => obj.first_name
			},
			lastName: {
				type: GraphQLString,
				resolve: (obj) => obj.last_name
			},
			contact: {
				type: GraphQLString,
				resolve: (obj) => obj.contact_no
			},
			enabled: {
				type: GraphQLBoolean,
				resolve: (obj) => !obj.disabled
			},
			avatarUrl: {
				type: GraphQLString,
				resolve: (obj) => obj.profile_image_url_small
			}
	  },
	  interfaces: [nodeInterface]
	});

	return {
		nodeType,
		...connectionDefinitions({nodeType})
	};
}
Exemplo n.º 20
0
function getConnectionField(graffitiModel, type, hooks = {}) {
  const { name } = type;
  const { plural } = hooks;
  const pluralName = toCollectionName(name.toLowerCase());
  const { connectionType } = connectionDefinitions({
    name,
    nodeType: type,
    connectionFields: {
      count: {
        name: 'count',
        type: GraphQLFloat
      }
    }
  });

  return {
    [pluralName]: {
      args: getArguments(type, connectionArgs),
      type: connectionType,
      resolve: addHooks((rootValue, args, info) => connectionFromModel(graffitiModel, args, info), plural)
    }
  };
}
Exemplo n.º 21
0
import { pageable } from "relay-cursor-paging"
import { parseRelayOptions } from "lib/helpers"
import { GraphQLInt } from "graphql"
import { connectionFromArraySlice, connectionDefinitions } from "graphql-relay"
import { assign } from "lodash"

import { ConversationType } from "./conversation"

export default {
  type: connectionDefinitions({
    nodeType: ConversationType,
    connectionFields: {
      totalUnreadCount: {
        type: GraphQLInt,
        resolve: ({ total_unread_count }) => total_unread_count,
      },
    },
  }).connectionType,
  description: "Conversations, usually between a user and partner.",
  args: pageable(),
  resolve: (root, options, request, { rootValue: { conversationsLoader } }) => {
    if (!conversationsLoader) return null
    const { page, size, offset } = parseRelayOptions(options)
    const expand = ["total_unread_count"]
    return conversationsLoader({ page, size, expand }).then(
      ({ total_count, total_unread_count, conversations }) => {
        return assign(
          { total_unread_count },
          connectionFromArraySlice(conversations, options, {
            arrayLength: total_count,
            sliceStart: offset,
Exemplo n.º 22
0
    address: {
      type: addressType,
      description: 'The address of the brewery.',
      resolve: (brewery) => brewery.address
    },
    coordinates: {
      type: coordinatePairType,
      description: 'The geographic location of the brewery.',
      resolve: (brewery) => brewery.coordinates
    }
  }),
  interfaces: [nodeInterface]
});

const { connectionType: breweryConnectionType } =
  connectionDefinitions({ name: 'Breweries', nodeType: breweryType });

// export const beerType = new GraphQLObjectType({
//   name: 'Beer',
//   description: 'A beer.',
//   fields: () => ({
//     id: globalIdField('Beer'),
//     brewery_id: {
//       type: new GraphQLNonNull(GraphQLString),
//       description: 'The brewery\'s unique identifier.'
//     },
//     name: {
//       type: GraphQLString,
//       description: 'The name of the beer.'
//     },
//     description: {
Exemplo n.º 23
0
      description: 'Text message',
    },
    avatar: {
      type: GraphQLString,
      resolve: (obj) => getAvatar(getUser(obj.addedBy).avatarId).content
    },
    addedAt: {
      type: GraphQLString,
      resolve: (obj) => obj.addedAt.toJSON()
    }
  }),
  interfaces: [nodeInterface],
});

var {connectionType: messageConnection} =
  connectionDefinitions({name: 'Message', nodeType: messageType});

var chatType = new GraphQLObjectType({
  name: 'Chat',
  fields: {
    id: globalIdField('Chat'),
    messages: {
      type: messageConnection,
      args: connectionArgs,
      resolve: (obj, args) =>
        connectionFromArray(getMessages(), args),
    },
    total: {
      type: GraphQLInt,
      resolve: () => getMessages().length,
    },
Exemplo n.º 24
0
    },
    totalNumberOfItems: {
      type: GraphQLInt,
      description: 'The total number of items.',
      resolve: ({}, {})=> {
        const start = 0;
        const size = 1;
        const result = productService.findAll({ start, size });
        return result.totalNumberOfItems;
      },
    },
  }),
  interfaces: [nodeInterface],
});

export const { connectionType: productListConnection, edgeType: productListEdge } =
  connectionDefinitions({ name: 'ProductList', nodeType: productListType });

export const queryProductList = {
  type: productListType,
  args: {},
  resolve: async ({}) => {
    logger.info('Resolving queryProductList with params:', {});

    return {};
  },
};


export default productListType;
      type: GraphQLString,
      resolve: (obj) => obj.text,
    },
    complete: {
      type: GraphQLBoolean,
      resolve: (obj) => obj.complete,
    }
  },
  interfaces: [nodeInterface]
});

var {
  connectionType: TodosConnection,
  edgeType: GraphQLTodoEdge,
} = connectionDefinitions({
  name: 'Todo',
  nodeType: GraphQLTodo,
});

var GraphQLUser = new GraphQLObjectType({
  name: 'User',
  fields: {
    id: globalIdField('User'),
    todos: {
      type: TodosConnection,
      args: {
        status: {
          type: GraphQLString,
          defaultValue: 'any',
        },
        ...connectionArgs,
      },
Exemplo n.º 26
0
  fields: () => ({
    id: globalIdField('Tag'),
    title: {
      type: GraphQLString,
      description: 'Title of the tag',
    },
    source: {
      type: GraphQLString,
      description: 'Java Script that inserts the tag',
    }
  }),
  interfaces: [nodeInterface],
})

var {connectionType: tagConnection, edgeType: TagEdgeType} =
  connectionDefinitions({ name: 'Tag', nodeType: tagType })

const queryType = new GraphQLObjectType({
  name: 'Query',
  fields: () => ({
    node: nodeField,
    game: {
      type: gameType,
      resolve: () => getGame(),
    },
  }),
});

const EditTagMutation = mutationWithClientMutationId({
  name: 'EditTag',
  inputFields: {
Exemplo n.º 27
0
  name: 'Bench',
  description: 'A bench',
  fields: () => ({
    id: globalIdField('Bench'),
    description: {type: GraphQLString},
    lat: {type: GraphQLFloat},
    lng: {type: GraphQLFloat},
    seating: {type: GraphQLInt}
  }),
  interfaces: [nodeInterface],
});

var {
  connectionType: BenchesConnection
} = connectionDefinitions({
  name: 'Bench',
  nodeType: benchType,
});

var userType = new GraphQLObjectType({
  name: 'User',
  fields: () => ({
    id: globalIdField('User'),
    bench: {
      type: benchType,
      args: {
        id: {
          description: 'the id of the bench',
          type: new GraphQLNonNull(GraphQLInt)
        },
      },
      resolve: resolver(Bench)
Exemplo n.º 28
0
export const ArtworkType = new GraphQLObjectType({
  name: "Artwork",
  interfaces: [NodeInterface],
  isTypeOf: obj => _.has(obj, "title") && _.has(obj, "artists"),
  fields: () => {
    return {
      ...artworkFields(),
      cached,
    }
  },
})

Artwork = {
  type: ArtworkType,
  description: "An Artwork",
  args: {
    id: {
      type: new GraphQLNonNull(GraphQLString),
      description: "The slug or ID of the Artwork",
    },
  },
  resolve: (root, { id }, request, { rootValue: { artworkLoader } }) => artworkLoader(id),
}

export default Artwork

export const artworkConnection = connectionDefinitions({
  nodeType: Artwork.type,
}).connectionType
Exemplo n.º 29
0
import Todo, { getTodo } from '../../data/Todo';
import { nodeInterface, registerNodeFetcher } from '../node';

const TODO_TYPE_NAME = 'Todo';

registerNodeFetcher(TODO_TYPE_NAME, id => getTodo(id));

const GraphQLTodo = new GraphQLObjectType({
  name: TODO_TYPE_NAME,
  fields: () => ({
    id: globalIdField(),
    text: {
      type: GraphQLString,
      resolve: obj => obj.text,
    },
    complete: {
      type: GraphQLBoolean,
      resolve: obj => obj.complete,
    },
  }),
  interfaces: () => [nodeInterface],
  isTypeOf: obj => obj instanceof Todo,
});

export const {
  connectionType: GraphQLTodoConnection,
  edgeType: GraphQLTodoEdge,
} = connectionDefinitions({ nodeType: GraphQLTodo });

export default GraphQLTodo;
Exemplo n.º 30
0
  name: "BuyersPremium",
  fields: {
    ...GravityIDFields,
    amount: amount(({ cents }) => cents),
    cents: {
      type: GraphQLInt,
      resolve: ({ cents }) => cents,
    },
    percent: {
      type: GraphQLFloat,
    },
  },
})

const saleArtworkConnection = connectionDefinitions({
  nodeType: SaleArtwork.type,
}).connectionType

const SaleType = new GraphQLObjectType({
  name: "Sale",
  interfaces: [NodeInterface],
  isTypeOf: obj => has(obj, "is_auction") && has(obj, "currency"),
  fields: () => {
    return {
      ...GravityIDFields,
      cached,
      artworks: {
        type: new GraphQLList(Artwork.type),
        args: {
          page: {
            type: GraphQLInt,