diff --git a/server/api.js b/server/api.js index 12b7e7f..865ef7d 100755 --- a/server/api.js +++ b/server/api.js @@ -77,7 +77,7 @@ module.exports = function (io, sql, app_cfg, waip) { data: data, app_id: app_id }); - sql.db_log('API', 'Einsatz an ' + app_cfg.endpoint.host + ' gesendet: ' + data); + sql.db_log('API', 'Einsatz an ' + app_cfg.endpoint.host + ' gesendet: ' + JSON.stringify(data)); }; }; @@ -92,7 +92,7 @@ module.exports = function (io, sql, app_cfg, waip) { data: data, app_id: app_id }); - sql.db_log('API', 'Rückmeldung an ' + app_cfg.endpoint.host + ' gesendet: ' + data); + sql.db_log('API', 'Rückmeldung an ' + app_cfg.endpoint.host + ' gesendet: ' + JSON.stringify(data)); }; }; @@ -145,7 +145,7 @@ module.exports = function (io, sql, app_cfg, waip) { if (app_id != app_cfg.global.app_id) { waip.rmld_speichern(data, app_cfg.endpoint.host, function (result) { if (!result) { - sql.db_log('API', 'Fehler beim speichern der Rückmeldung von ' + app_cfg.endpoint.host + ': ' + data); + sql.db_log('API', 'Fehler beim speichern der Rückmeldung von ' + app_cfg.endpoint.host + ': ' + JSON.stringify(data)); }; }); }; @@ -163,7 +163,7 @@ module.exports = function (io, sql, app_cfg, waip) { data: data, app_id: app_id }); - sql.db_log('API', 'Neuen Wachalarm an ' + app_cfg.endpoint.host + ' gesendet: ' + data); + sql.db_log('API', 'Neuen Wachalarm an ' + app_cfg.endpoint.host + ' gesendet: ' + JSON.stringify(data)); }; }; @@ -178,7 +178,7 @@ module.exports = function (io, sql, app_cfg, waip) { data: data, app_id: app_id }); - sql.db_log('API', 'Rückmeldung an ' + app_cfg.endpoint.host + ' gesendet: ' + data); + sql.db_log('API', 'Rückmeldung an ' + app_cfg.endpoint.host + ' gesendet: ' + JSON.stringify(data)); }; }; diff --git a/server/routing.js b/server/routing.js index bd3b35e..7877df7 100755 --- a/server/routing.js +++ b/server/routing.js @@ -214,7 +214,6 @@ module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, waip, udp, // Rueckmeldung anzeigen /rueckmeldung/waip_uuid/rmld_uuid app.get('/rmld/:waip_uuid/:rmld_uuid', function (req, res, next) { - var waip_uuid = req.params.waip_uuid; var rmld_uuid = req.params.rmld_uuid; sql.db_einsatz_get_by_uuid(waip_uuid, function (einsatzdaten) { diff --git a/server/sql_qry.js b/server/sql_qry.js index a35f955..e175d2e 100755 --- a/server/sql_qry.js +++ b/server/sql_qry.js @@ -9,7 +9,6 @@ module.exports = function (db, uuidv4, app_cfg) { // SQL-Abfragen function db_einsatz_speichern(content, callback) { - content = JSON.parse(content); // uuid erzeugen und zuweisen falls nicht vorhanden if (!content.einsatzdaten.uuid) { content.einsatzdaten.uuid = uuidv4(); diff --git a/server/udp.js b/server/udp.js index 34bbaf3..b7093fd 100644 --- a/server/udp.js +++ b/server/udp.js @@ -24,6 +24,7 @@ module.exports = function(app_cfg, waip, sql, api) { // Warten auf Einsatzdaten udp_server.on('message', function(message, remote) { if (isValidJSON(message)) { + message = JSON.parse(message); sql.db_log('WAIP', 'Neuer Einsatz von ' + remote.address + ':' + remote.port + ': ' + message); waip.waip_speichern(message); // Einsatzdaten per API weiterleiten (entweder zum Server oder zum verbunden Client) diff --git a/server/waip.js b/server/waip.js index e3a1f80..6752359 100755 --- a/server/waip.js +++ b/server/waip.js @@ -99,14 +99,15 @@ module.exports = function (io, sql, fs, brk, async, app_cfg, proof) { function rmld_speichern(rueckmeldung, host, callback) { // Rueckmeldung speichern und verteilen - proof.validate_rmld(req.body, function (valid) { + proof.validate_rmld(rueckmeldung, function (valid) { if (valid) { if (!host == null) { host = ' von ' + host; }; + console.log(rueckmeldung); sql.db_rmld_save(rueckmeldung, function (result) { if (result) { - waip.rmld_verteilen_by_uuid(rueckmeldung.waip_uuid, rueckmeldung.rmld_uuid); + rmld_verteilen_by_uuid(rueckmeldung.waip_uuid, rueckmeldung.rmld_uuid); sql.db_log('RMLD', 'Rückmeldung' + host + ' erhalten und gespeichert: ' + result); callback && callback(result); } else {