trying an earlier version

This commit is contained in:
Luke Berndt
2023-04-11 20:20:30 -04:00
parent 60944e4d4f
commit dc1b190b5f
4 changed files with 16 additions and 8 deletions

View File

@@ -1,7 +1,13 @@
const Talkgroup = require("../models/talkgroup");
exports.get_talkgroups = async function (req, res) {
const tg_results = await Talkgroup.find({ 'shortName': req.params.shortName.toLowerCase()})
const tg_results = await Talkgroup.find({ 'shortName': req.params.shortName.toLowerCase()}).catch(err => {
console.error(err);
res.status(500);
res.json({ success: false, message: err });
return;
});
var talkgroups = {};
for (var tg in tg_results) {
talkgroups[tg_results[tg].num] = tg_results[tg];