Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/root/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ 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)
}, _a)) : __assign(__assign({}, fields), (_b = {}, _b[modelType.name] = list_1["default"](modelType, allSchemaDeclarations, outputTypes, models, globalPreCallback), _b));
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.
Expand All @@ -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) {
Expand Down
8 changes: 0 additions & 8 deletions src/root/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down