Added frond-end and needed get calls.
This commit is contained in:
20
endpoints/listgroupusers.js
Normal file
20
endpoints/listgroupusers.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//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
|
||||
}
|
||||
Reference in New Issue
Block a user