-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I cannot seem to figure out how to satisfy the webpack compiler nor the tooling used to build the schema so that it will let me have arguments on nested fields.
location: {
description: 'A query allowing search of Inventory Locations',
type: new GraphQLList(Location),
args: {
id: {
type: GraphQLInt,
},
locationName: {
description: 'The Location Name to search for.',
type: GraphQLString,
},
offset: {
description: 'The offset for the database query, for example 10 would return results 11 and beyond.',
type: GraphQLInt,
},
limit: {
description: 'The row limit, for example, setting this to 25 will return a maximum of 25. When combined with offset, can be used to paginate.',
type: GraphQLInt,
},
},
resolve(root, args) {
return InventoryDb.models.location.findAll({
include: [
{
model: InventoryDb.models.inventoryItem,
// limit: args.limit,
// offset: args.offset,
through: {
// model: InventoryDb.models.locationInventory,
attributes: ['locationItemPrice', 'locationItemOnHand'],
},
order: [
['id', 'asc'],
['inventoryItems.id', 'asc'],
],
},
{
model: InventoryDb.models.person,
through: {
model: InventoryDb.models.locationEmployees,
attributes: ['jobTitle'],
},
order: ['id', 'asc'],
},
],
where: args,
order: [
['id', 'asc'],
],
});
},
},
The query :
query{ location(id: 2, limit: 2) { id locationName items(limit:3){ id itemName } } }
I need the arguments for the limit and offset to work, but they are not valid arguments and the query errors.
How should I construct the query schema so that these will function properly?