alsmanager_lib 1.0.95 → 1.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/modules.js +53 -3
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1196,6 +1196,40 @@ function removeDeviceConfiguration(db_used, id_conf) {
1196
1196
  return query;
1197
1197
  }
1198
1198
  //
1199
+ function getPartChangedSQLite(id_conf, id_device, id_part, part_type) {
1200
+ var query = "select id, id_conf, id_device, part_type, id_part, operation from change_config ";
1201
+ query += "where id_conf = " + id_conf + " ";
1202
+ query += "and id_device = " + id_device + " ";
1203
+ query += "and id_part = " + id_part + " ";
1204
+ query += "and part_type = '" + part_type + "' ";
1205
+ return query;
1206
+ }
1207
+
1208
+ function getPartChangedMySQL(id_conf, id_device, id_part, part_type) {
1209
+ var query = "select id, id_conf, id_device, part_type, id_part, operation from change_config ";
1210
+ query += "where id_conf = :id_conf ";
1211
+ query += "and id_device = :id_device ";
1212
+ query += "and id_part = :id_part ";
1213
+ query += "and part_type = :part_type ";
1214
+ return query;
1215
+ }
1216
+
1217
+ function getPartChanged(db_used, id_conf, id_device, id_part, part_type) {
1218
+ var query = "";
1219
+ if (db_used) {
1220
+ switch (db_used) {
1221
+ case 'SQLITE':
1222
+ query = getPartChangedSQLite(id_conf, id_device, id_part, part_type);
1223
+ break;
1224
+ case 'MYSQL':
1225
+ query = getPartChangedMySQL(id_conf, id_device, id_part, part_type);
1226
+ break;
1227
+ }
1228
+ }
1229
+ return query;
1230
+ }
1231
+
1232
+
1199
1233
  function insertPartChangedSQLite(id_conf, id_device, id_part, part_type, operation, id_part_replaced) {
1200
1234
  var query = "insert into change_config (id_conf, id_device, part_type, id_part, operation, id_part_replaced) values (";
1201
1235
  query += id_conf + ", ";
@@ -1614,7 +1648,7 @@ function getPCProperties(db_used, id_device) {
1614
1648
  }
1615
1649
  function createPCPropertiesMySQLObj(id_device, dev_prop) {
1616
1650
  var obj = {};
1617
- obj.id = dev_prop.id_prop;
1651
+ obj.id_prop = dev_prop.id_prop;
1618
1652
  obj.id_device = id_device;
1619
1653
  obj.pc_name = dev_prop.pc_name;
1620
1654
  obj.os = dev_prop.os;
@@ -1670,12 +1704,27 @@ function updatePCPropertiesSQLite(id_device, dev_prop) {
1670
1704
  query += "note = '" + dev_prop.note + "', ";
1671
1705
  query += "da_properties = " + dev_prop.da_properties + " ";
1672
1706
  query += "where id_device = " + id_device + " ";
1673
- query += "and id = " + dev_prop.id;
1707
+ query += "and id = " + dev_prop.id_prop;
1674
1708
  return query;
1675
1709
  }
1676
1710
 
1677
1711
  function updatePCPropertiesMySQL() {
1678
-
1712
+ var query = "update device_pc set ";
1713
+ query += "id_device = :id_device, ";
1714
+ query += "pc_name = :pc_name, ";
1715
+ query += "OS = :os, ";
1716
+ query += "OS_version = :os_version, ";
1717
+ query += "OS_arch = :os_arch, ";
1718
+ query += "CPU = :cpu, ";
1719
+ query += "CPU_arch = :cpu_arch, ";
1720
+ query += "RAM_GB = :ram_size, ";
1721
+ query += "video_card = :video_card, ";
1722
+ query += "smartboard_ready = :smartboard_ready, ";
1723
+ query += "note = :note, ";
1724
+ query += "da_properties = :da_properties ";
1725
+ query += "where id_device = :id_device ";
1726
+ query += "and id = :id_prop";
1727
+ return query;
1679
1728
  }
1680
1729
  function updatePCProperties(db_used, id_device, dev_prop) {
1681
1730
  var query = "";
@@ -9003,6 +9052,7 @@ module.exports = {
9003
9052
  insertDeviceConfiguration,
9004
9053
  updateDeviceConfiguration,
9005
9054
  removeDeviceConfiguration,
9055
+ getPartChanged,
9006
9056
  insertPartChanged,
9007
9057
  updatePartChanged,
9008
9058
  removePartChanged,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",