Comparing version 0.7.2 to 0.7.3
@@ -421,6 +421,11 @@ !function () { | ||
// take the joins, apply them to the parent | ||
joins.forEach(function(joinStatement, index) { | ||
joins.forEach(function(joinStatement) { | ||
currentTargetResource.query.join.push(joinStatement.reverseFormat()); | ||
}.bind(this)); | ||
// we need to add ou filter and joins to all branches sourcing from here | ||
this._joinAndFilterSideTree(name, sourceResource.filters, joins, currentTargetResource, lastTargetResource); | ||
// we should not join any table twice, check if we joined this pair already | ||
@@ -443,2 +448,31 @@ if (currentTargetResource.subJoinApplied && lastTargetResource.subJoinApplied) { | ||
/* | ||
* add filters to side branches | ||
*/ | ||
, _joinAndFilterSideTree: function(sourceName, filters, joins, resource, parentResource) { | ||
if (resource && resource.hasChildren()) { | ||
resource.getChildren().forEach(function(childResource) { | ||
if (childResource.name !== sourceName && (!parentResource || parentResource.name !== childResource.name)) { | ||
//log.warn('%s applying itself to %s; %s', sourceName, childResource.name, parentResource ? parentResource.name : undefined, filters); | ||
// make sure there is an object to write to | ||
if (!childResource.query.filter[sourceName]) childResource.query.filter[sourceName] = {}; | ||
Object.keys(filters).forEach(function(key){ | ||
childResource.query.filter[sourceName][key] = filters[key]; | ||
}); | ||
// take the joins, apply them to the parent | ||
joins.forEach(function(joinStatement) { | ||
childResource.query.join.push(joinStatement.reverseFormat()); | ||
}.bind(this)); | ||
// go down the branch | ||
this._joinAndFilterSideTree(sourceName, filters, joins, childResource, resource); | ||
} | ||
}.bind(this)); | ||
} | ||
} | ||
/* | ||
* add my own pks to the select statement | ||
@@ -445,0 +479,0 @@ */ |
{ | ||
"name" : "ee-orm" | ||
, "description" : "ORM for node.js supporting postgres or mysql. Supports eager loading, complex queries, joins, transactions, complex database clusters & connection pooling." | ||
, "version" : "0.7.2" | ||
, "version" : "0.7.3" | ||
, "homepage" : "https://github.com/eventEmitter/ee-orm" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
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
261110
5005