Sfoglia il codice sorgente

scoper on find query.by default adds limit 100

Ivan Asmer 5 anni fa
parent
commit
36dd925ef0
1 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 7 5
      expand.js

+ 7 - 5
expand.js

@@ -1,11 +1,13 @@
 const { buildSchema, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList, GraphQLSchema } = require('graphql');
 const { buildSchema, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList, GraphQLSchema } = require('graphql');
 const ObjectID    = require("mongodb").ObjectID;
 const ObjectID    = require("mongodb").ObjectID;
 const bound       = 100;
 const bound       = 100;
-function scoper(query,cursorCalls=[{},{limit:[limitValue=100]}]) {
-    console.log(limit)
-    return params
-}
-function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper=scoper){
+function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper){
+    function scoperTest(query,cursorCalls=[{},{limit:[limitValue=100]}]) {
+        console.log(limit)
+        return params
+    }
+    scoper=scoper || scoperTest
+
     const types    = {}
     const types    = {}
     const _typeMap = gqlSchema.getTypeMap()
     const _typeMap = gqlSchema.getTypeMap()