Explorar o código

scoper on find query.by default adds limit 100

Ivan Asmer %!s(int64=5) %!d(string=hai) anos
pai
achega
36dd925ef0
Modificáronse 1 ficheiros con 7 adicións e 5 borrados
  1. 7 5
      expand.js

+ 7 - 5
expand.js

@@ -1,11 +1,13 @@
 const { buildSchema, GraphQLObjectType, GraphQLString, GraphQLInt, GraphQLList, GraphQLSchema } = require('graphql');
 const ObjectID    = require("mongodb").ObjectID;
 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 _typeMap = gqlSchema.getTypeMap()