Skip to content

Commit

Permalink
Add ignore list in getCompanies
Browse files Browse the repository at this point in the history
  • Loading branch information
polo2ro committed Apr 14, 2019
1 parent 633c5a6 commit 25849c9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions api/Company.api.js
Expand Up @@ -131,7 +131,6 @@ exports = module.exports = {
* @param {object} app headless application
* @param {function} callback function to receive results
*
* @return {Array}
*/
listDatabases: function listDatabases(app, callback) {
const Admin = app.mongoose.mongo.Admin(app.db.db);
Expand Down Expand Up @@ -450,13 +449,20 @@ exports = module.exports = {
/**
* Get all company documents from all the databases
* Promise resolve to an associated object wher keys are dbnames
*
* The schemas will be loaded for each company, if a database is not a gadael
* db it can be ignored with the ignoreList param
*
* @param {Object} app
* @param {Array} ignoreList
* @return {Promise}
*/
getCompanies: function getCompanies(app) {
getCompanies: function getCompanies(app, ignoreList) {

let api = this;
if (undefined === ignoreList) {
ignoreList = [];
}

return new Promise((resolve, reject) => {

Expand All @@ -466,8 +472,7 @@ exports = module.exports = {
let asyncTasks = [];
for(var i=0; i<databases.length; i++) {

if (databases[i]) {

if (databases[i] && -1 === ignoreList.indexOf(databases[i].name)) {
var task = {
db: databases[i].name,
getCompany: function(async_done) {
Expand Down

0 comments on commit 25849c9

Please sign in to comment.