mbouclas / loopback-ds-tree-mixin

Transform a loopback model into a tree using the Array of Ancestors pattern
MIT License
6 stars 4 forks source link

Include filter is ignored by allTree API #21

Open haresh333 opened 5 years ago

haresh333 commented 5 years ago

I am invoking allTree API. Where filter and order filter works. but if I provide include filter it is ignored. it apprear the code is missing. I fixed it as below ... , include:filter.include , so I added it in Model.asTree() . You may please make necessary changes to the master

    filter.where.parent={exists:false};
    Model.find(filter,function (err, rootNodes) {
        Promise.all(rootNodes.map(function (rootNode) {
            return Model.asTree(rootNode,{withParent:true,order:filter.order , include:filter.include }); // added by Haresh 30-Jan-2019  include:filter.include
mbouclas commented 5 years ago

Please submit a PR so that i can test and publish.