mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 09:17:30 -05:00
First Commit
This commit is contained in:
18
backend/controllers/talkgroups.js
Normal file
18
backend/controllers/talkgroups.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var db = require('../db');
|
||||
|
||||
exports.get_talkgroups = function(req, res) {
|
||||
db.get().collection('talkgroups', function(err, tg_coll) {
|
||||
tg_coll.find({
|
||||
'shortName': req.params.shortName.toLowerCase()
|
||||
}).toArray(function(err, tg_results) {
|
||||
var talkgroups = {};
|
||||
for (var tg in tg_results) {
|
||||
talkgroups[tg_results[tg].num] = tg_results[tg];
|
||||
}
|
||||
res.contentType('json');
|
||||
res.send(JSON.stringify({
|
||||
talkgroups: talkgroups
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user