Files
old-naida/endpoints/listgroupusers.js
2019-11-07 01:10:25 +01:00

20 lines
513 B
JavaScript

//Call for listing all groups with their users - needed for control panel
//
const handleListGroup = (req, res, db) => {
db.transaction (trx => {
trx.select('*')
.from('groups')
.orderBy('groupname', 'asc')
.orderBy('username', 'asc')
.then( data => {
res.json(data);
})
.then(trx.commit)
.catch(trx.rollback)
.catch (err => res.status(400).json('Error accesing database.'))
})
}
module.exports = {
handleListGroup
}