diff --git a/frontend/server/index.js b/frontend/server/index.js index 6d8b163..69ad50a 100644 --- a/frontend/server/index.js +++ b/frontend/server/index.js @@ -115,7 +115,7 @@ exports.get_card = function(req, res) { } */ -function getCalls(req, res, next) { +async function getCalls(req, res, next) { if (req.query && req.query["call-id"]) { @@ -126,26 +126,34 @@ function getCalls(req, res, next) { next() return; } + db.get().collection('calls', function (err, transCollection) { transCollection.findOne({ '_id': o_id }, - function (err, item) { + async function (err, item) { if (item) { var time = new Date(item.time); var timeString = time.toLocaleTimeString("en-US"); var dateString = time.toDateString(); //console.log(item) + const tg_coll = db.get().collection('talkgroups'); + const tg = await tg_coll.findOne({ "num": item.talkgroupNum, 'shortName': req.params.shortName.toLowerCase()}) + var title = item.len + " second transmission" + if (tg) { + console.log(tg) + title = tg.description; + } const callId = req.query["call-id"]; const callUrl = "https://s3.us-west-1.wasabisys.com/openmhz-west/media/dcfd-1039-1613917169.m4a" const twitterMeta = ` - - + +