update So 14. Jun 20:01:01 CEST 2020
This commit is contained in:
parent
31f9216933
commit
1e8058a57f
@ -77,7 +77,7 @@ module.exports = function (io, sql, app_cfg, waip) {
|
|||||||
data: data,
|
data: data,
|
||||||
app_id: app_id
|
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,
|
data: data,
|
||||||
app_id: app_id
|
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) {
|
if (app_id != app_cfg.global.app_id) {
|
||||||
waip.rmld_speichern(data, app_cfg.endpoint.host, function (result) {
|
waip.rmld_speichern(data, app_cfg.endpoint.host, function (result) {
|
||||||
if (!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,
|
data: data,
|
||||||
app_id: app_id
|
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,
|
data: data,
|
||||||
app_id: app_id
|
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));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -214,7 +214,6 @@ module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, waip, udp,
|
|||||||
|
|
||||||
// Rueckmeldung anzeigen /rueckmeldung/waip_uuid/rmld_uuid
|
// Rueckmeldung anzeigen /rueckmeldung/waip_uuid/rmld_uuid
|
||||||
app.get('/rmld/:waip_uuid/:rmld_uuid', function (req, res, next) {
|
app.get('/rmld/:waip_uuid/:rmld_uuid', function (req, res, next) {
|
||||||
|
|
||||||
var waip_uuid = req.params.waip_uuid;
|
var waip_uuid = req.params.waip_uuid;
|
||||||
var rmld_uuid = req.params.rmld_uuid;
|
var rmld_uuid = req.params.rmld_uuid;
|
||||||
sql.db_einsatz_get_by_uuid(waip_uuid, function (einsatzdaten) {
|
sql.db_einsatz_get_by_uuid(waip_uuid, function (einsatzdaten) {
|
||||||
|
|||||||
@ -9,7 +9,6 @@ module.exports = function (db, uuidv4, app_cfg) {
|
|||||||
// SQL-Abfragen
|
// SQL-Abfragen
|
||||||
|
|
||||||
function db_einsatz_speichern(content, callback) {
|
function db_einsatz_speichern(content, callback) {
|
||||||
content = JSON.parse(content);
|
|
||||||
// uuid erzeugen und zuweisen falls nicht vorhanden
|
// uuid erzeugen und zuweisen falls nicht vorhanden
|
||||||
if (!content.einsatzdaten.uuid) {
|
if (!content.einsatzdaten.uuid) {
|
||||||
content.einsatzdaten.uuid = uuidv4();
|
content.einsatzdaten.uuid = uuidv4();
|
||||||
|
|||||||
@ -24,6 +24,7 @@ module.exports = function(app_cfg, waip, sql, api) {
|
|||||||
// Warten auf Einsatzdaten
|
// Warten auf Einsatzdaten
|
||||||
udp_server.on('message', function(message, remote) {
|
udp_server.on('message', function(message, remote) {
|
||||||
if (isValidJSON(message)) {
|
if (isValidJSON(message)) {
|
||||||
|
message = JSON.parse(message);
|
||||||
sql.db_log('WAIP', 'Neuer Einsatz von ' + remote.address + ':' + remote.port + ': ' + message);
|
sql.db_log('WAIP', 'Neuer Einsatz von ' + remote.address + ':' + remote.port + ': ' + message);
|
||||||
waip.waip_speichern(message);
|
waip.waip_speichern(message);
|
||||||
// Einsatzdaten per API weiterleiten (entweder zum Server oder zum verbunden Client)
|
// Einsatzdaten per API weiterleiten (entweder zum Server oder zum verbunden Client)
|
||||||
|
|||||||
@ -99,14 +99,15 @@ module.exports = function (io, sql, fs, brk, async, app_cfg, proof) {
|
|||||||
|
|
||||||
function rmld_speichern(rueckmeldung, host, callback) {
|
function rmld_speichern(rueckmeldung, host, callback) {
|
||||||
// Rueckmeldung speichern und verteilen
|
// Rueckmeldung speichern und verteilen
|
||||||
proof.validate_rmld(req.body, function (valid) {
|
proof.validate_rmld(rueckmeldung, function (valid) {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (!host == null) {
|
if (!host == null) {
|
||||||
host = ' von ' + host;
|
host = ' von ' + host;
|
||||||
};
|
};
|
||||||
|
console.log(rueckmeldung);
|
||||||
sql.db_rmld_save(rueckmeldung, function (result) {
|
sql.db_rmld_save(rueckmeldung, function (result) {
|
||||||
if (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);
|
sql.db_log('RMLD', 'Rückmeldung' + host + ' erhalten und gespeichert: ' + result);
|
||||||
callback && callback(result);
|
callback && callback(result);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user