directory.findAll({raw: true}) // Запрос ко всей таблице
.then(tables => {
var table = tables.reduce((acc, n) => {
const g = n.subBranch || n.branch;
(acc[g] = acc[g] || []).push(n);
return acc;
},{});
})
.finally(() => {
console.log(table);
});
});
directory.findAll({raw: true}) // Запрос ко всей таблице
.then(tables => {
return tables.reduce((acc, n) => {
const g = n.subBranch || n.branch;
(acc[g] = acc[g] || []).push(n);
return acc;
},{});
})
.finally(table => {
console.log(table);
});
});