upgraded most of the Backend

This commit is contained in:
Luke Berndt
2023-04-08 12:57:12 -04:00
parent 329dc7f47b
commit 6ae3f25215
14 changed files with 977 additions and 3068 deletions

View File

@@ -1,18 +1,15 @@
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
}));
});
});
exports.get_talkgroups = async function (req, res) {
const tg_coll = db.get().collection('talkgroups');
const cursor = tg_coll.find({ 'shortName': req.params.shortName.toLowerCase() })
const tg_results = await cursor.toArray();
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
}));
}