소스 검색

scoper on find query.by default adds limit 100

Ivan Asmer 5 년 전
부모
커밋
908bcf52cb
1개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 6
      expand.js

+ 2 - 6
expand.js

@@ -1,12 +1,8 @@
 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;
-const scoper      = (...params) => {
-    if (params[1] && params[1].limit && Array.isArray(params[1].limit)){ 
-        let limit = params[1].limit[0]
-        if (!(Number.isInt(limit) && limit <= bound && limit > 0)){
-            params[1].limit = [bound]
-    }
+const scoper      = (...params=[{},{limit:[limitValue]}]) => {
+    console.log(limit)
     return params
     return params
 }
 }
 function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper=scoper )){
 function mmExpandSchema(gqlSchema, defaultQueryFields, defaultMutationFields, scoper=scoper )){