From df03c2b60b7e7607c98cd26fbae407eba8ee928c Mon Sep 17 00:00:00 2001 From: brucx Date: Fri, 11 Aug 2017 10:45:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20skip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schema.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema.js b/schema.js index c7caaf9..0fcddd2 100644 --- a/schema.js +++ b/schema.js @@ -178,6 +178,9 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { limit: { type: GraphQLInt }, + skip: { + type: GraphQLInt + }, equalTo: { type: createFieldsInputType('equalTo') }, @@ -241,7 +244,7 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { }; function addArgumentsToQuery(query, args) { - ['ascending', 'descending', 'limit'].forEach( method => { + ['ascending', 'descending', 'limit', 'skip'].forEach( method => { if (args[method] !== undefined) { query[method](args[method]); } From 9de74c8c76711668d4466070455c8036c1224c1d Mon Sep 17 00:00:00 2001 From: brucx Date: Fri, 11 Aug 2017 11:00:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20contains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schema.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema.js b/schema.js index 0fcddd2..ce14437 100644 --- a/schema.js +++ b/schema.js @@ -196,6 +196,9 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { lessThanOrEqualTo: { type: createFieldsInputType('lessThanOrEqualTo') }, + contains: { + type: createFieldsInputType('contains') + }, containedIn: { type: createFieldsInputType('containedIn', new GraphQLList(GraphQLID)) }, @@ -251,7 +254,7 @@ function addArgumentsToQuery(query, args) { }); ['equalTo', 'greaterThan', 'greaterThanOrEqualTo', 'lessThan', - 'lessThanOrEqualTo', 'containedIn', 'containsAll'].forEach( method => { + 'lessThanOrEqualTo', 'contains', 'containedIn', 'containsAll'].forEach( method => { if (_.isObject(args[method])) { _.forEach(args[method], (value, key) => { query[method](key, value); From c360d8deb0454e51e91ef403c0b1bf5113a68185 Mon Sep 17 00:00:00 2001 From: brucx Date: Fri, 11 Aug 2017 15:22:00 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20addAscending=EF=BC=8Ca?= =?UTF-8?q?ddDescending?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schema.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/schema.js b/schema.js index ce14437..1882c3f 100644 --- a/schema.js +++ b/schema.js @@ -181,6 +181,12 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { skip: { type: GraphQLInt }, + addAscending: { + type: GraphQLString + }, + addDescending: { + type: GraphQLString + }, equalTo: { type: createFieldsInputType('equalTo') }, @@ -247,7 +253,7 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { }; function addArgumentsToQuery(query, args) { - ['ascending', 'descending', 'limit', 'skip'].forEach( method => { + ['ascending', 'descending', 'addAscending', 'addDescending', 'limit', 'skip'].forEach( method => { if (args[method] !== undefined) { query[method](args[method]); } From 1412b20f40eb7d49829b572e270891d8f11873b4 Mon Sep 17 00:00:00 2001 From: brucx Date: Fri, 11 Aug 2017 15:31:33 +0800 Subject: [PATCH 4/4] update addAscending tpye --- schema.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema.js b/schema.js index 1882c3f..8d0cd1e 100644 --- a/schema.js +++ b/schema.js @@ -182,10 +182,10 @@ module.exports = function buildSchema({appId, appKey, masterKey}) { type: GraphQLInt }, addAscending: { - type: GraphQLString + type: FieldsEnum }, addDescending: { - type: GraphQLString + type: FieldsEnum }, equalTo: { type: createFieldsInputType('equalTo')