simple-graphql
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "simple-graphql", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "The simple way to build GraphQL style API with MySQL/PostreSQL", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -232,34 +232,36 @@ 'use strict'; | ||
case 0: | ||
conditionFieldKeys.forEach(function (fieldKey) { | ||
if (args.condition && args.condition[fieldKey]) { | ||
args.condition[fieldKey] = _.mapKeys(args.condition[fieldKey], function (value, key) { | ||
return '$' + key; | ||
}); | ||
} | ||
}); | ||
dbModel = models[model.name]; | ||
condition = {}; | ||
_.forOwn(model.config.fields, function (value, key) { | ||
if (value instanceof _ModelRef2.default || value && value.$type instanceof _ModelRef2.default) { | ||
if (!key.endsWith('Id')) { | ||
key = key + 'Id'; | ||
if (args && args.condition) { | ||
conditionFieldKeys.forEach(function (fieldKey) { | ||
if (args.condition && args.condition[fieldKey]) { | ||
args.condition[fieldKey] = _.mapKeys(args.condition[fieldKey], function (value, key) { | ||
return '$' + key; | ||
}); | ||
} | ||
if (typeof args.condition[key] !== 'undefined') { | ||
if (dbModel.options.underscored) { | ||
condition[key.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toLocaleLowerCase()] = args.condition[key]; | ||
} else { | ||
condition[key] = args.condition[key]; | ||
}); | ||
condition = {}; | ||
_.forOwn(model.config.fields, function (value, key) { | ||
if (value instanceof _ModelRef2.default || value && value.$type instanceof _ModelRef2.default) { | ||
if (!key.endsWith('Id')) { | ||
key = key + 'Id'; | ||
} | ||
if (typeof args.condition[key] !== 'undefined') { | ||
if (dbModel.options.underscored) { | ||
condition[key.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toLocaleLowerCase()] = args.condition[key]; | ||
} else { | ||
condition[key] = args.condition[key]; | ||
} | ||
} | ||
} else if (typeof args.condition[key] !== 'undefined') { | ||
condition[key] = args.condition[key]; | ||
} | ||
} else if (typeof args.condition[key] !== 'undefined') { | ||
condition[key] = args.condition[key]; | ||
} | ||
}); | ||
args.condition = condition; | ||
}); | ||
args.condition = condition; | ||
} | ||
return _context.abrupt('return', _index2.default.Connection.resolve(dbModel, args)); | ||
case 6: | ||
case 3: | ||
case 'end': | ||
@@ -266,0 +268,0 @@ return _context.stop(); |
{ | ||
"name": "simple-graphql", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "The simple way to build GraphQL style API with MySQL/PostreSQL", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1886263
5209