From 7ab55e07883587cbf28a3bbcb62d24406184df5d Mon Sep 17 00:00:00 2001 From: germainvictor Date: Tue, 31 May 2022 23:34:14 +0200 Subject: [PATCH 1/2] fix(Count Resolver): Remove list resolver on count --- src/root/query.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/root/query.ts b/src/root/query.ts index 58a96b0..553bc43 100644 --- a/src/root/query.ts +++ b/src/root/query.ts @@ -46,14 +46,6 @@ function getModelsFields( schemaDeclaration.actions.indexOf('count') > -1 ? { ...fields, - // LIST RESOLVER - [modelType.name]: generateListResolver( - modelType, - allSchemaDeclarations, - outputTypes, - models, - globalPreCallback - ), // COUNT RESOLVER [`${modelType.name}Count`]: { type: GraphQLInt, From d674fb5b8eebcc16265d6481283b7ad754be2a77 Mon Sep 17 00:00:00 2001 From: germainvictor Date: Wed, 1 Jun 2022 09:36:59 +0200 Subject: [PATCH 2/2] Add build --- lib/root/query.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/root/query.js b/lib/root/query.js index f72cd62..bdf9557 100644 --- a/lib/root/query.js +++ b/lib/root/query.js @@ -38,7 +38,7 @@ function getModelsFields(allSchemaDeclarations, outputTypes, models, globalPreCa } var result = schemaDeclaration.actions && schemaDeclaration.actions.indexOf('count') > -1 - ? __assign(__assign({}, fields), (_a = {}, _a[modelType.name] = list_1["default"](modelType, allSchemaDeclarations, outputTypes, models, globalPreCallback), _a[modelType.name + "Count"] = { + ? __assign(__assign({}, fields), (_a = {}, _a[modelType.name + "Count"] = { type: graphql_1.GraphQLInt, args: __assign(__assign({}, graphql_sequelize_1.defaultArgs(schemaDeclaration.model)), graphql_sequelize_1.defaultListArgs()), resolve: count_1["default"](schemaDeclaration.model, schemaDeclaration, globalPreCallback) @@ -46,7 +46,7 @@ function getModelsFields(allSchemaDeclarations, outputTypes, models, globalPreCa return result; }, {}); } -function getCustomEndpoints(allSchemaDeclarations, outputTypes, models) { +function getCustomEndpoints(allSchemaDeclarations, outputTypes) { return Object.keys(allSchemaDeclarations).reduce(function (fields, endpointKey) { var _a; // We ignore all endpoints matching a model type. @@ -69,7 +69,7 @@ function generateQueryRootResolver(allSchemaDeclarations, outputTypes, models, g // Endpoints depending on a model var modelFields = getModelsFields(allSchemaDeclarations, outputTypes, models, globalPreCallback); // Custom endpoints, without models specified. - var customEndpoints = getCustomEndpoints(allSchemaDeclarations, outputTypes, models); + var customEndpoints = getCustomEndpoints(allSchemaDeclarations, outputTypes); var modelsKeys = Object.keys(modelFields); Object.keys(customEndpoints).filter(function (value) { if (modelsKeys.indexOf(value) !== -1) {