update Mo 15. Jun 22:01:01 CEST 2020
This commit is contained in:
parent
cf882740b7
commit
9425067cf3
@ -38,13 +38,13 @@ app.use(bodyParser.urlencoded({
|
||||
var sql_cfg = require('./server/sql_cfg')(fs, bcrypt, app_cfg);
|
||||
var sql = require('./server/sql_qry')(sql_cfg, app_cfg);
|
||||
var brk = require('./server/broker')(app_cfg, sql, uuidv4);
|
||||
var waip = require('./server/waip')(io, sql, fs, brk, async, app_cfg);
|
||||
var saver = require('./server/saver')(app_cfg, sql, waip, uuidv4);
|
||||
var api = require('./server/api')(io, sql, app_cfg, saver);
|
||||
var waip = require('./server/waip')(io, sql, fs, brk, async, app_cfg, api);
|
||||
var socket = require('./server/socket')(io, sql, app_cfg, waip);
|
||||
var api = require('./server/api')(io, sql, app_cfg, waip);
|
||||
var saver = require('./server/saver')(app_cfg, sql, waip, api, uuidv4);
|
||||
var udp = require('./server/udp')(app_cfg, sql, saver);
|
||||
var auth = require('./server/auth')(app, app_cfg, sql_cfg, async, bcrypt, passport, io);
|
||||
var routes = require('./server/routing')(app, sql, uuidv4, app_cfg, passport, auth, waip, udp, saver);
|
||||
var routes = require('./server/routing')(app, sql, uuidv4, app_cfg, passport, auth, udp, saver);
|
||||
|
||||
// Server starten
|
||||
webserver.listen(app_cfg.global.https_port, function () {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = function (io, sql, app_cfg, waip) {
|
||||
module.exports = function (io, sql, app_cfg, saver) {
|
||||
|
||||
// Module laden
|
||||
const io_api = require('socket.io-client');
|
||||
@ -38,7 +38,7 @@ module.exports = function (io, sql, app_cfg, waip) {
|
||||
if (app_id != app_cfg.global.app_id) {
|
||||
// nicht erwuenschte Daten ggf. enfernen (Datenschutzoption)
|
||||
filter_api_data(data, remote_ip, function (data_filtered) {
|
||||
waip.waip_speichern(data_filtered, app_id);
|
||||
saver.save_new_waip(data_filtered, remote_ip, app_id);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + remote_ip + ': ' + data_filtered);
|
||||
});
|
||||
};
|
||||
@ -131,7 +131,7 @@ module.exports = function (io, sql, app_cfg, waip) {
|
||||
// nicht erwuenschte Daten ggf. enfernen (Datenschutzoption)
|
||||
app_cfg.endpoint.host
|
||||
filter_api_data(data, app_cfg.endpoint.host, function (data_filtered) {
|
||||
waip.waip_speichern(data_filtered, app_id);
|
||||
saver.save_new_waip(data_filtered, app_cfg.endpoint.host, app_id);
|
||||
sql.db_log('API', 'Neuer Wachalarm von ' + app_cfg.endpoint.host + ': ' + data_filtered);
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, waip, udp, api) {
|
||||
module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, udp, saver) {
|
||||
|
||||
/* ########################### */
|
||||
/* ##### Statische Seiten #### */
|
||||
@ -244,7 +244,8 @@ module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, waip, udp,
|
||||
|
||||
// Rueckmeldung entgegennehmen
|
||||
app.post('/rmld/:waip_uuid/:rmld_uuid', function (req, res) {
|
||||
waip.rmld_speichern(req.body, null, function (result) {
|
||||
// auf Saver verweisen
|
||||
saver.save_new_rmld(req.body, null, 'web', function (result) {
|
||||
var waip_uuid = req.body.waip_uuid;
|
||||
var rmld_uuid = req.body.rmld_uuid;
|
||||
if (result) {
|
||||
@ -254,9 +255,6 @@ module.exports = function (app, sql, uuidv4, app_cfg, passport, auth, waip, udp,
|
||||
req.flash('errorMessage', 'Fehler beim Senden der Rückmeldung!');
|
||||
res.redirect('/rmld/' + waip_uuid + '/' + rmld_uuid);
|
||||
};
|
||||
// TODO TEST: Api WAIP
|
||||
api.server_to_client_new_rmld(req.body, 'web');
|
||||
api.client_to_server_new_rmld(req.body, 'web');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = function (app_cfg, sql, waip, api, uuidv4) {
|
||||
module.exports = function (app_cfg, sql, waip, uuidv4) {
|
||||
|
||||
// Module laden
|
||||
const turf = require('@turf/turf');
|
||||
@ -40,34 +40,32 @@ module.exports = function (app_cfg, sql, waip, api, uuidv4) {
|
||||
// wenn ein Einsatz mit UUID schon vorhanden ist, dann diese setzten / ueberschreiben
|
||||
content.einsatzdaten.uuid = row.uuid;
|
||||
} else {
|
||||
// uuid erzeugen und zuweisen falls nicht bereits in JSON vorhanden
|
||||
if (!content.einsatzdaten.uuid) {
|
||||
// uuid erzeugen und zuweisen falls nicht bereits in JSON vorhanden, oder falls keine korrekte uuid
|
||||
if (!content.einsatzdaten.uuid || !uuid_pattern.test(content.einsatzdaten.uuid) {
|
||||
content.einsatzdaten.uuid = uuidv4();
|
||||
};
|
||||
};
|
||||
// Einsatz in DB Speichern
|
||||
waip.waip_speichern(waip_data);
|
||||
sql.db_log('WAIP', 'Neuer Einsatz von ' + remote_addr + ': ' + waip_data);
|
||||
// Einsatzdaten per API weiterleiten (entweder zum Server oder zum verbunden Client)
|
||||
// TODO TEST: Api WAIP
|
||||
api.server_to_client_new_waip(waip_data, app_id);
|
||||
api.client_to_server_new_waip(waip_data, app_id);
|
||||
waip.waip_speichern(waip_data, app_id);
|
||||
sql.db_log('WAIP', 'Neuer Einsatz von ' + remote_addr + ' wird jetzt verarbeitet: ' + waip_data);
|
||||
});
|
||||
} else {
|
||||
sql.db_log('Fehler-WAIP', 'Fehler: Einsatz von ' + remote_addr + ' nicht valide: ' + waip_data);
|
||||
sql.db_log('WAIP', 'Fehler: Einsatz von ' + remote_addr + ' nicht valide: ' + waip_data);
|
||||
};
|
||||
});
|
||||
} else {
|
||||
sql.db_log('Fehler-WAIP', 'Fehler: Einsatz von ' + remote_addr + ' Fehlerhaft: ' + waip_data);
|
||||
sql.db_log('WAIP', 'Fehler: Einsatz von ' + remote_addr + ' Fehlerhaft: ' + waip_data);
|
||||
};
|
||||
};
|
||||
|
||||
function save_new_rmld(data, app_id) {
|
||||
function save_new_rmld(data, remote_addr, app_id, callback) {
|
||||
validate_rmld(data, function (valid) {
|
||||
if (valid) {
|
||||
|
||||
|
||||
// TODO TEST: Api WAIP
|
||||
api.server_to_client_new_rmld(req.body, 'web');
|
||||
api.client_to_server_new_rmld(req.body, 'web');
|
||||
} else {
|
||||
sql.db_log('RMLD', 'Fehler: Rückmeldung von nicht valide: ' + waip_data);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = function (io, sql, fs, brk, async, app_cfg) {
|
||||
module.exports = function (io, sql, fs, brk, async, app_cfg, api) {
|
||||
|
||||
// Module laden
|
||||
const json2csv = require('json2csv');
|
||||
@ -48,6 +48,10 @@ module.exports = function (io, sql, fs, brk, async, app_cfg) {
|
||||
};
|
||||
});
|
||||
});
|
||||
// Einsatzdaten per API weiterleiten (entweder zum Server oder zum verbunden Client)
|
||||
// TODO TEST: Api WAIP
|
||||
api.server_to_client_new_waip(waip_data, app_id);
|
||||
api.client_to_server_new_waip(waip_data, app_id);
|
||||
};
|
||||
|
||||
function waip_verteilen(waip_id, socket, wachen_nr) {
|
||||
@ -115,6 +119,9 @@ module.exports = function (io, sql, fs, brk, async, app_cfg) {
|
||||
});
|
||||
};
|
||||
});
|
||||
// TODO TEST: Api WAIP
|
||||
api.server_to_client_new_rmld(req.body, 'web');
|
||||
api.client_to_server_new_rmld(req.body, 'web');
|
||||
};
|
||||
|
||||
function rmld_verteilen_by_uuid(waip_uuid, rmld_uuid) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user