From 4b56858975946b46ddcf83787eecdaf68594dd82 Mon Sep 17 00:00:00 2001 From: Byron Lopez Date: Sat, 5 Oct 2019 12:40:56 -0600 Subject: [PATCH] Fixing missing limit/offset error. Added limit and offset as required fields. Removed code validations in people.js https://github.com/blopez2010/graphql_livestock_auction_server/issues/7 --- src/queries/people.js | 4 ---- src/schema/schema.graphql | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/queries/people.js b/src/queries/people.js index d97525c..bb5d23c 100644 --- a/src/queries/people.js +++ b/src/queries/people.js @@ -5,10 +5,6 @@ const { paginate } = require('./extensions'); module.exports = { allPeoplePaginated: async (parent, { name, offset, limit }) => { - if (!offset || !limit) { - throw new Error('Missing offset and/or limit fields'); - } - const where = name ? { name: { [Op.like]: `%${name.trim()}%` diff --git a/src/schema/schema.graphql b/src/schema/schema.graphql index ab8cce3..c0bd2e6 100644 --- a/src/schema/schema.graphql +++ b/src/schema/schema.graphql @@ -4,7 +4,7 @@ type Query { allEvents: [Event!]! getEventByYear(year: String!): Event allPeople: [People!]! - allPeoplePaginated(name: String, offset: Int, limit: Int): PeoplePaginationResultPayload! + allPeoplePaginated(name: String, offset: Int!, limit: Int!): PeoplePaginationResultPayload! findPeopleByName(name: String!): [People!]! allItems: [Item!]! getItemsByEvent(year: Int!): [Item!]