I think it is ready...

This commit is contained in:
Luke Berndt
2023-01-23 22:12:54 -05:00
parent a002fb1fe4
commit aa4d343039
11 changed files with 108 additions and 43 deletions

View File

@@ -17,7 +17,6 @@ function get_calls(query, numResults, res) {
var fields = {
_id: true,
talkgroupNum: true,
shortName: true,
path: true,
name: true,
time: true,
@@ -39,7 +38,6 @@ function get_calls(query, numResults, res) {
if (item) {
call = {
_id: item._id.toHexString(),
shortName: item.shortName,
talkgroupNum: item.talkgroupNum,
url: item.url,
filename: item.path + item.name,
@@ -248,7 +246,7 @@ exports.remove_star = function(req, res, next) {
try {
var o_id = ObjectID.createFromHexString(objectId);
} catch (err) {
console.warn("[" + req.params.shortName + "] Error - /:shortName/call/:id generating ObjectID " + err);
console.warn("[" + req.params.shortName + "] Error - /remove_star/:id generating ObjectID " + err);
res.status(500);
res.send(JSON.stringify({
success: false,
@@ -283,7 +281,7 @@ exports.add_star = function(req, res, next) {
try {
var o_id = ObjectID.createFromHexString(objectId);
} catch (err) {
console.warn("[" + req.params.shortName + "] Error - /:shortName/call/:id generating ObjectID " + err);
console.warn("[" + req.params.shortName + "] Error - /add_star/:id generating ObjectID " + err);
res.status(500);
res.send(JSON.stringify({
success: false,

View File

@@ -171,6 +171,8 @@ function addSystemClients(req, res, next) {
/*------ CALLS ----------*/
app.get('/card/:id', calls.get_card);
app.post('/add_star/:id', calls.add_star);
app.post('/remove_star/:id', calls.remove_star);
app.get('/:shortName/call/:id', calls.get_call);
app.get('/:shortName/calls/latest', calls.get_latest_calls);
app.get('/:shortName/calls/next', calls.get_next_calls);
@@ -178,8 +180,7 @@ app.get('/:shortName/calls/newer', calls.get_newer_calls);
app.get('/:shortName/calls/older', calls.get_older_calls);
app.get('/:shortName/calls/:time/older', calls.get_iphone_calls);
app.get('/:shortName/calls', calls.get_calls);
app.post('/:shortName/star/:id', calls.add_star);
app.post('/:shortName/removeStar/:id', calls.remove_star);
/*------ UPLOADS ---------- upload.single('call'), uploads.upload,*/
app.post('/:shortName/upload', upload.single('call'), uploads.upload, async function (req, res) {