Added utils directory to repository.

This commit is contained in:
ThePendulum 2019-04-04 21:10:44 +02:00
parent 86d4e8feb7
commit cbb4fdc919
1 changed files with 24 additions and 0 deletions

24
src/utils/list.js Normal file
View File

@ -0,0 +1,24 @@
'use strict';
const Promise = require('bluebird');
const knex = require('../knex');
async function listSites() {
const networks = await knex('networks').orderBy('name');
await Promise.each(networks, async (network) => {
console.log(`* **${network.name}**`);
const sites = await knex('sites')
.where({ network_id: network.id })
.orderBy('name');
if (sites.length === 1 && sites[0].name === network.name) {
return;
}
sites.forEach(site => console.log(` * ${site.name}`));
});
}
listSites();