update Di 16. Jun 14:31:01 CEST 2020

This commit is contained in:
Robert Richter 2020-06-16 14:31:01 +02:00
parent d74e85246e
commit 30e13fde85
3 changed files with 9 additions and 16 deletions

View File

@ -247,10 +247,12 @@ module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, udp, saver
// Remote-IP erkennen, fuer Fehler-Auswertung
var remote_ip = req.headers["x-real-ip"] || req.headers['x-forwarded-for'] || req.connection.remoteAddress;
// auf Saver verweisen
saver.save_new_rmld(req.body, remote_ip, 'web', function (result) {
saver.save_new_rmld(req.body, remote_ip, 'web', function (saved) {
var waip_uuid = req.body.waip_uuid;
var rmld_uuid = req.body.rmld_uuid;
if (result) {
console.log(saved);
console.log(req);
if (saved) {
req.flash('successMessage', 'Rückmeldung erfolgreich gesendet, auf zum Einsatz!');
res.redirect('/rmld/' + waip_uuid + '/' + rmld_uuid);
} else {

View File

@ -68,20 +68,15 @@ module.exports = function (app_cfg, sql, waip, uuidv4, io, remote_api) {
function save_new_rmld(data, remote_addr, app_id, callback) {
validate_rmld(data, function (valid) {
if (valid) {
console.log('hier');
// Rueckmeldung speichern und verteilen
sql.db_rmld_save(data, function (result) {
console.log('hier auch');
console.log(result);
if (result) {
sql.db_log('RMLD', 'Rückmeldung von ' + remote_addr + ' erhalten und gespeichert: ' + JSON.stringify(data));
waip.rmld_verteilen_by_uuid(data.waip_uuid, data.rmld_uuid);
callback && callback(result);
callback && callback(true);
} else {
sql.db_log('RMLD', 'Fehler beim speichern der Rückmeldung von ' + remote_addr + ': ' + JSON.stringify(data));
callback && callback(result);
callback && callback(false);
};
});
// RMLD-Daten per API weiterleiten (entweder zum Server oder zum verbunden Client)
@ -90,7 +85,7 @@ module.exports = function (app_cfg, sql, waip, uuidv4, io, remote_api) {
api_client_to_server_new_rmld(req.body, app_id);
} else {
sql.db_log('RMLD', 'Fehler: Rückmeldung von ' + remote_addr + ' nicht valide: ' + JSON.stringify(waip_data));
callback && callback(valid);
callback && callback(false);
};
});
};

View File

@ -685,10 +685,6 @@ module.exports = function (db, app_cfg) {
};
// Rueckmeldung der Wache zuordnen
db.get(`select name_wache, nr_wache from waip_wachen where id = ?;`, [reuckmeldung.wache_id], function (err, row) {
console.log(err);
console.log(row);
console.log(reuckmeldung);
if (err == null && row) {
reuckmeldung.wache_name = row.name_wache;
reuckmeldung.wache_nr = row.nr_wache;