alsmanager_lib 1.0.52 → 1.0.53

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 +75 -9
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -56,6 +56,16 @@ function getConnectorById(db_used, id_conn) {
56
56
  return query;
57
57
  }
58
58
 
59
+ function createConnectorObjMySQL(id_device, conn_obj) {
60
+ var obj = {};
61
+ obj.id_device = id_device;
62
+ obj.id = conn_obj.id;
63
+ obj.tipo = conn_obj.tipo;
64
+ obj.protocollo = conn_obj.protocollo;
65
+ obj.numero = conn_obj.numero;
66
+ obj.verso = conn_obj.verso;
67
+ return obj;
68
+ }
59
69
 
60
70
  function insertConnectorSQLite(id_device, conn_obj) {
61
71
  //dc.id, ct.conn_type as Tipo, cp.name as Protocollo, dc.conn_number as Numero, dc.conn_verse as Verso from device_connectors
@@ -200,15 +210,31 @@ function getStorageById(db_used, id_storage) {
200
210
  return query;
201
211
  }
202
212
 
213
+ function createStorageObjMySQL(id_device, storage_obj) {
214
+ var obj = {};
215
+ obj.id_device = id_device;
216
+ obj.id = storage_obj.id;
217
+ obj.tipo = storage_obj.tipo;
218
+ obj.unita = storage_obj.unita;
219
+ obj.dimensione = storage_obj.dimensione;
220
+ obj.dim_disponibile = storage_obj.dim_disponibile;
221
+ obj.marca = storage_obj.marca;
222
+ obj.modello = storage_obj.modello;
223
+ obj.is_replaced = storage_obj.is_replaced;
224
+ obj.date_replaced = storage_obj.date_replaced;
225
+ return obj;
226
+ }
227
+
203
228
  function insertStorageSQLite(id_device, storage_obj) {
204
- var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available) values ";
205
- query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", " + storage_obj.dim_disponibile + ")";
229
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model, is_replaced, date_replaced) values ";
230
+ query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", " + storage_obj.dim_disponibile + ", ";
231
+ query += "'" + storage_obj.marca + "', '" + storage_obj.modello + "', " + storage_obj.is_replaced + ", '" + storage_obj.date_replaced + "')";
206
232
  return query;
207
233
  }
208
234
 
209
235
  function insertStorageMySQL(id_device, storage_obj) {
210
- var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available) values ";
211
- query += "(:id_device, :tipo, :unita, :dimensione, :dim_disponibile)";
236
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model, is_replaced, date_replaced) values ";
237
+ query += "(:id_device, :tipo, :unita, :dimensione, :dim_disponibile, :marca, :modello, :is_replaced, :date_replaced)";
212
238
  return query;
213
239
  }
214
240
 
@@ -233,7 +259,11 @@ function updateStorageSQLite(id_device, storage_obj) {
233
259
  query += "storage_type = " + storage_obj.tipo + ", ";
234
260
  query += "storage_size_unit = '" + storage_obj.unita + "', ";
235
261
  query += "storage_totsize = " + storage_obj.dimensione + ", ";
236
- query += "storage_available = " + storage_obj.dim_disponibile + " ";
262
+ query += "storage_available = " + storage_obj.dim_disponibile + ", ";
263
+ query += "storage_manifacturer = '" + storage_obj.marca + "', ";
264
+ query += "storage_model = '" + storage_obj.modello + "', ";
265
+ query += "is_replaced = " + storage_obj.is_replaced + ", ";
266
+ query += "date_replaced = '" + storage_obj.date_replaced + "' ";
237
267
  query += "where id = " + storage_obj.id;
238
268
  return query;
239
269
  }
@@ -245,6 +275,10 @@ function updateStorageMySQL(id_device, storage_obj) {
245
275
  query += "storage_size_unit = :unita, ";
246
276
  query += "storage_totsize = :dimensione, ";
247
277
  query += "storage_available = :dim_disponibile ";
278
+ query += "storage_manifacturer = :marca, ";
279
+ query += "storage_model = :modello, ";
280
+ query += "is_replaced = :is_replaced, ";
281
+ query += "date_replaced = :date_replaced ";
248
282
  query += "where id = id_storage";
249
283
  return query;
250
284
  }
@@ -340,6 +374,18 @@ function getNetworkById(db_used, id_network) {
340
374
  }
341
375
  return query;
342
376
  }
377
+
378
+ function createNetworkObjMySQL(id_device, network_obj) {
379
+ var obj = {};
380
+ obj.id_device = id_device;
381
+ obj.id = network_obj.id;
382
+ obj.tipo = network_obj.tipo;
383
+ obj.mac_address = network_obj.mac_address;
384
+ obj.ipv4_static = network_obj.ipv4_static;
385
+ obj.ipv6_static = network_obj.ipv6_static;
386
+ return obj;
387
+ }
388
+
343
389
  function insertNetworkSQLite(id_device, network_obj) {
344
390
  var query = "insert into device_networks (id_device, net_type, mac_address, ipv4_static, ipv6_static) values ";
345
391
  query += "(" + id_device + ", '" + network_obj.tipo + "', '" + network_obj.mac_address + "', '" + network_obj.ipv4_static + "', '" + network_obj.ipv6_static + "')";
@@ -460,7 +506,7 @@ function getAddOnByIdMySQL() {
460
506
  query += "where id = :id_addon";
461
507
  return query;
462
508
  }
463
- function getAddOnById(id_addon) {
509
+ function getAddOnById(db_used, id_addon) {
464
510
  var query = "";
465
511
  if (db_used) {
466
512
  switch (db_used) {
@@ -474,6 +520,19 @@ function getAddOnById(id_addon) {
474
520
  }
475
521
  return query;
476
522
  }
523
+
524
+ function createAddOnObjMySQL(id_device, addon_obj) {
525
+ var obj = {};
526
+ obj.id_device = id_device;
527
+ obj.id = addon_obj.id;
528
+ obj.addon_type = addon_obj.addon_type;
529
+ obj.maker = addon_obj.maker;
530
+ obj.model = addon_obj.model;
531
+ obj.description = addon_obj.description;
532
+ return obj;
533
+ }
534
+
535
+
477
536
  function insertAddOnSQLite(id_device, addon_obj) {
478
537
  var query = "insert into device_addons (id_device, addon_type, maker, model, description) values ";
479
538
  query += "(" + id_device + ", " + addon_obj.addon_type + ", '" + addon_obj.maker + "', '" + addon_obj.model + "', '" + addon_obj.description + "')";
@@ -612,7 +671,7 @@ function getPCProperties(db_used, id_device) {
612
671
  query = getPCPropertiesSQLite(id_device);
613
672
  break;
614
673
  case 'MYSQL':
615
- query = getPCPropertiesSQLite(id_device);
674
+ query = getPCPropertiesMySQL(id_device);
616
675
  break;
617
676
  }
618
677
  }
@@ -1280,10 +1339,10 @@ function getDevicesCounterByPlace(db_used, id_place) {
1280
1339
  if (db_used) {
1281
1340
  switch (db_used) {
1282
1341
  case 'SQLITE':
1283
- query = alsmgr.getDevicesCounterByPlaceSQLite(id_place);
1342
+ query = getDevicesCounterByPlaceSQLite(id_place);
1284
1343
  break;
1285
1344
  case 'MYSQL':
1286
- query = alsmgr.getDevicesCounterByPlaceMySQL(id_place);
1345
+ query = getDevicesCounterByPlaceMySQL(id_place);
1287
1346
  break;
1288
1347
  }
1289
1348
  }
@@ -7400,23 +7459,30 @@ module.exports = {
7400
7459
  insertDisplayProperties,
7401
7460
  updateDisplayProperties,
7402
7461
  getDisplayPartProperties,
7462
+ existsDisplayPartProperties,
7463
+ insertDisplayPartProperties,
7464
+ updateDisplayPartProperties,
7403
7465
  getConnectorsByIdDevice,
7404
7466
  getConnectorById,
7467
+ createConnectorObjMySQL,
7405
7468
  insertConnector,
7406
7469
  updateConnector,
7407
7470
  removeConnector,
7408
7471
  getStorageByIdDevice,
7409
7472
  getStorageById,
7473
+ createStorageObjMySQL,
7410
7474
  insertStorage,
7411
7475
  updateStorage,
7412
7476
  removeStorage,
7413
7477
  getNetworkByIdDevice,
7414
7478
  getNetworkById,
7479
+ createNetworkObjMySQL,
7415
7480
  insertNetwork,
7416
7481
  updateNetwork,
7417
7482
  removeNetwork,
7418
7483
  getAddOnByIdDevice,
7419
7484
  getAddOnById,
7485
+ createAddOnObjMySQL,
7420
7486
  insertAddOn,
7421
7487
  updateAddOn,
7422
7488
  removeAddOn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",