diff --git a/server/sql_qry.js b/server/sql_qry.js index 65656c8..c76515d 100755 --- a/server/sql_qry.js +++ b/server/sql_qry.js @@ -155,7 +155,8 @@ module.exports = function (db, uuidv4, app_cfg) { delete einsatzdaten.em_weitere; var uuid_einsatzdaten = uuidv5(JSON.stringify(einsatzdaten), custom_namespace); - + // wenn keine row, dann insert + db.get('select * from waip_history where waip_id like ? and socket_id like ?', [waip_id, socket_id], function (err, row) { if (err == null && row) { callback && callback(row); @@ -806,24 +807,15 @@ module.exports = function (db, uuidv4, app_cfg) { }; function db_vmtl_get_list(waip_id, callback) { - // FIXME eee - - - db.run(`CREATE TABLE waip_vmtl ( - id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, - waip_wachen_id INTEGER, - vmtl_typ TEXT, - vmlt_account_name TEXT, - vmlt_account_list TEXT, - bkp_recipient TEXT, - FOREIGN KEY(waip_wachen_id) REFERENCES waip_wachen(id))`); - // Log erstellen - // Pruefen ob fuer eine Wache im Einsatz ein Verteilerliste hinterlegt ist - db.get(`select t.waip_wachen_id, t.vmlt_typ, t.vmtl_account_name, t.vmtl_account_list from waip_vmtl t - where waip_wachen_id = (select distinct w.id wachen_id from waip_wachen w left join waip_einsatzmittel em on em.wachenname = w.name_wache + db.get(`select v.waip_wachen_id, v.vmlt_typ, v.vmtl_account_name, v.vmtl_account_list from waip_vmtl v + where v.waip_wachen_id = (select distinct w.id wachen_id from waip_wachen w left join waip_einsatzmittel em on em.wachenname = w.name_wache where em.waip_einsaetze_ID = ?)`, [waip_id], function (err, liste) { if (err == null && liste) { + + // FIXME eee + v.waip_wachen_id, v.vmlt_typ, v.vmtl_account_name, v.vmtl_account_list + // Falls Liste für Wache hinterlegt, je nach Typ de // Falls Account und Liste hinterlegt sind, die Account-Zugangsdaten, Einsatz-UUID, Einsatzart und Wachenname auslesen db.get(`select tw.tw_screen_name, tw_consumer_key, tw.tw_consumer_secret, tw.tw_access_token_key, tw.tw_access_token_secret, we.uuid, we.einsatzart, wa.name_wache