alsmanager_lib 1.0.84 → 1.0.85

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 +84 -0
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -381,6 +381,33 @@ function removeStorage(db_used, id_device, storage_obj) {
381
381
  }
382
382
  return query;
383
383
  }
384
+
385
+ function getLastStorageInsertedSQLite(id_device) {
386
+ var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
387
+ query += "where id_device = " + id_device + " ";
388
+ query += "order by id desc LIMIT 1";
389
+ return query;
390
+ }
391
+ function getLastStorageInsertedMySQL(id_device) {
392
+ var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
393
+ query += "where id_device = :id_device ";
394
+ query += "order by id desc LIMIT 1";
395
+ return query;
396
+ }
397
+ function getLastStorageInserted(db_used, id_device) {
398
+ var query = "";
399
+ if (db_used) {
400
+ switch (db_used) {
401
+ case 'SQLITE':
402
+ query = getLastStorageInsertedSQLite(id_device);
403
+ break;
404
+ case 'MYSQL':
405
+ query = getLastStorageInsertedMySQL(id_device);
406
+ break;
407
+ }
408
+ }
409
+ return query;
410
+ }
384
411
  //
385
412
  function getStoragesByConfigSQLite(id_device, id_conf) {
386
413
  var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
@@ -621,6 +648,33 @@ function removeNetwork(db_used, id_device, network_obj) {
621
648
  }
622
649
  return query;
623
650
  }
651
+
652
+ function getLastNetworkInsertedSQLite(id_device) {
653
+ var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
654
+ query += "where id_device = " + id_device + " ";
655
+ query += "order by id desc LIMIT 1";
656
+ return query;
657
+ }
658
+ function getLastNetworkInsertedMySQL(id_device) {
659
+ var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
660
+ query += "where id_device = :id_device ";
661
+ query += "order by id desc LIMIT 1";
662
+ return query;
663
+ }
664
+ function getLastNetworkInserted(db_used, id_device) {
665
+ var query = "";
666
+ if (db_used) {
667
+ switch (db_used) {
668
+ case 'SQLITE':
669
+ query = getLastNetworkInsertedSQLite(id_device);
670
+ break;
671
+ case 'MYSQL':
672
+ query = getLastNetworkInsertedMySQL(id_device);
673
+ break;
674
+ }
675
+ }
676
+ return query;
677
+ }
624
678
  //
625
679
  function getNetworksByConfigSQLite(id_device, id_conf) {
626
680
  var query = "select dn.id, dn.net_type as Tipo, dn.mac_address as MAC, dn.ipv4_static as IP4, dn.ipv6_static as IP6 from device_networks dn ";
@@ -885,6 +939,33 @@ function removeAddOn(db_used, id_device, addon_obj) {
885
939
  }
886
940
  return query;
887
941
  }
942
+
943
+ function getLastAddOnInsertedSQLite(id_device) {
944
+ var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
945
+ query += "where id_device = " + id_device + " ";
946
+ query += "order by id desc LIMIT 1";
947
+ return query;
948
+ }
949
+ function getLastAddOnInsertedMySQL(id_device) {
950
+ var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
951
+ query += "where id_device = :id_device ";
952
+ query += "order by id desc LIMIT 1";
953
+ return query;
954
+ }
955
+ function getLastAddOnInserted(db_used, id_device) {
956
+ var query = "";
957
+ if (db_used) {
958
+ switch (db_used) {
959
+ case 'SQLITE':
960
+ query = getLastAddOnInsertedSQLite(id_device);
961
+ break;
962
+ case 'MYSQL':
963
+ query = getLastAddOnInsertedMySQL(id_device);
964
+ break;
965
+ }
966
+ }
967
+ return query;
968
+ }
888
969
  //
889
970
  function getAddOnsByConfigSQLite(id_device, id_conf) {
890
971
  var query = "select da.id, a.name as Tipo, da.maker as Marca, da.model as Modello, da.description as Descrizione from device_addons da ";
@@ -8716,6 +8797,7 @@ module.exports = {
8716
8797
  insertStorage,
8717
8798
  updateStorage,
8718
8799
  removeStorage,
8800
+ getLastStorageInserted,
8719
8801
  getStoragesByConfig,
8720
8802
  getNetworkByIdDevice,
8721
8803
  getNetworkComboByIdDevice,
@@ -8725,6 +8807,7 @@ module.exports = {
8725
8807
  insertNetwork,
8726
8808
  updateNetwork,
8727
8809
  removeNetwork,
8810
+ getLastNetworkInserted,
8728
8811
  getNetworksByConfig,
8729
8812
  getAddOnTypes,
8730
8813
  getAddOnByIdDevice,
@@ -8735,6 +8818,7 @@ module.exports = {
8735
8818
  insertAddOn,
8736
8819
  updateAddOn,
8737
8820
  removeAddOn,
8821
+ getLastAddOnInserted,
8738
8822
  getAddOnsByConfig,
8739
8823
  //
8740
8824
  getDeviceConfigurations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",