alsmanager_lib 1.0.81 → 1.0.83

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.
@@ -922,14 +922,76 @@ CREATE TABLE IF NOT EXISTS "device_usage" (
922
922
  "note" TEXT,
923
923
  PRIMARY KEY("id" AUTOINCREMENT)
924
924
  );
925
- CREATE TABLE IF NOT EXISTS "device_config" (
925
+ CREATE TABLE IF NOT EXISTS "device_changes" (
926
926
  "id" INTEGER,
927
927
  "id_device" INTEGER,
928
928
  "date_conf" TEXT,
929
- "id_storage" INTEGER,
930
- "id_network" INTEGER,
931
- "id_addon" INTEGER,
932
929
  "note" TEXT,
933
930
  PRIMARY KEY("id" AUTOINCREMENT)
934
931
  );
932
+ CREATE TABLE IF NOT EXISTS "log_exports" (
933
+ "id" INTEGER,
934
+ "date_export" TEXT,
935
+ "filename" TEXT,
936
+ "hostname" INTEGER,
937
+ PRIMARY KEY("id" AUTOINCREMENT)
938
+ );
939
+ CREATE TABLE IF NOT EXISTS "anagrafica_docenti" (
940
+ "id" INTEGER,
941
+ "cognome" TEXT,
942
+ "nome" TEXT,
943
+ "email" TEXT,
944
+ PRIMARY KEY("id" AUTOINCREMENT)
945
+ );
946
+ CREATE TABLE IF NOT EXISTS "prn_stampe" (
947
+ "id" INTEGER,
948
+ "id_docente" INTEGER,
949
+ "num_stampe_bn" INTEGER,
950
+ "num_stampe_color" INTEGER,
951
+ PRIMARY KEY("id" AUTOINCREMENT)
952
+ );
953
+ CREATE TABLE IF NOT EXISTS "docenti_classi" (
954
+ "id" INTEGER,
955
+ "id_docente" INTEGER,
956
+ "id_place" TEXT,
957
+ "id_site" INTEGER,
958
+ PRIMARY KEY("id" AUTOINCREMENT)
959
+ );
960
+ CREATE TABLE IF NOT EXISTS "prn_ricariche" (
961
+ "id" INTEGER,
962
+ "id_docente" INTEGER,
963
+ "data_ricarica" TEXT,
964
+ "num_stampe_bn" INTEGER,
965
+ "num_stampa_c" INTEGER,
966
+ "id_device" INTEGER,
967
+ PRIMARY KEY("id")
968
+ );
969
+ CREATE TABLE IF NOT EXISTS "device_memory" (
970
+ "id" INTEGER,
971
+ "id_device" INTEGER,
972
+ "mem_type" TEXT,
973
+ "manifacturer" TEXT,
974
+ "model" TEXT,
975
+ "mem_size" INTEGER,
976
+ "mem_size_unit" TEXT,
977
+ PRIMARY KEY("id")
978
+ );
979
+ CREATE TABLE IF NOT EXISTS "change_config" (
980
+ "id" INTEGER,
981
+ "id_conf" INTEGER,
982
+ "part_type" TEXT,
983
+ "id_part" INTEGER,
984
+ "operation" TEXT,
985
+ "id_part_replaced" INTEGER,
986
+ PRIMARY KEY("id" AUTOINCREMENT)
987
+ );
988
+ CREATE TABLE IF NOT EXISTS "disk_usage" (
989
+ "id" INTEGER,
990
+ "date_ref" TEXT,
991
+ "id_device" INTEGER,
992
+ "id_storage" INTEGER,
993
+ "size_unit" TEXT,
994
+ "available_space" REAL,
995
+ PRIMARY KEY("id" AUTOINCREMENT)
996
+ );
935
997
  COMMIT;
package/lib/modules.js CHANGED
@@ -156,14 +156,14 @@ function removeConnector(db_used, id_device, conn_obj) {
156
156
  //End Manage connectors
157
157
  // Manage Storage
158
158
  function getStorageByIdDeviceSQLite(id_device) {
159
- var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
159
+ 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 ";
160
160
  query += "join storage_types st on st.id = ds.storage_type ";
161
161
  query += "where id_device = " + id_device;
162
162
  return query;
163
163
  }
164
164
 
165
165
  function getStorageByIdDeviceMySQL(id_device) {
166
- var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
166
+ 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 ";
167
167
  query += "join storage_types st on st.id = ds.storage_type ";
168
168
  query += "where id_device = :id_device";
169
169
  return query;
@@ -252,13 +252,13 @@ function getStorageByIdPartAndIdConf(db_used, id_storage, id_conf) {
252
252
 
253
253
 
254
254
  function getStorageByIdSQLite(id_storage) {
255
- var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
255
+ var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
256
256
  query += "where id = " + id_storage;
257
257
  return query;
258
258
  }
259
259
 
260
260
  function getStorageByIdMySQL() {
261
- var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
261
+ var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
262
262
  query += "where id = :id_storage";
263
263
  return query;
264
264
  }
@@ -285,24 +285,21 @@ function createStorageObjMySQL(id_device, storage_obj) {
285
285
  obj.tipo = storage_obj.tipo;
286
286
  obj.unita = storage_obj.unita;
287
287
  obj.dimensione = storage_obj.dimensione;
288
- obj.dim_disponibile = storage_obj.dim_disponibile;
289
288
  obj.marca = storage_obj.marca;
290
289
  obj.modello = storage_obj.modello;
291
- obj.is_replaced = storage_obj.is_replaced;
292
- obj.date_replaced = storage_obj.date_replaced;
293
290
  return obj;
294
291
  }
295
292
 
296
293
  function insertStorageSQLite(id_device, storage_obj) {
297
- 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 ";
298
- query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", " + storage_obj.dim_disponibile + ", ";
299
- query += "'" + storage_obj.marca + "', '" + storage_obj.modello + "', " + storage_obj.is_replaced + ", '" + storage_obj.date_replaced + "')";
294
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model) values ";
295
+ query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", ";
296
+ query += "'" + storage_obj.marca + "', '" + storage_obj.modello + "')";
300
297
  return query;
301
298
  }
302
299
 
303
300
  function insertStorageMySQL(id_device, storage_obj) {
304
- 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 ";
305
- query += "(:id_device, :tipo, :unita, :dimensione, :dim_disponibile, :marca, :modello, :is_replaced, :date_replaced)";
301
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model) values ";
302
+ query += "(:id_device, :tipo, :unita, :dimensione, :marca, :modello)";
306
303
  return query;
307
304
  }
308
305
 
@@ -327,11 +324,8 @@ function updateStorageSQLite(id_device, storage_obj) {
327
324
  query += "storage_type = " + storage_obj.tipo + ", ";
328
325
  query += "storage_size_unit = '" + storage_obj.unita + "', ";
329
326
  query += "storage_totsize = " + storage_obj.dimensione + ", ";
330
- query += "storage_available = " + storage_obj.dim_disponibile + ", ";
331
327
  query += "storage_manifacturer = '" + storage_obj.marca + "', ";
332
- query += "storage_model = '" + storage_obj.modello + "', ";
333
- query += "is_replaced = " + storage_obj.is_replaced + ", ";
334
- query += "date_replaced = '" + storage_obj.date_replaced + "' ";
328
+ query += "storage_model = '" + storage_obj.modello + "' ";
335
329
  query += "where id = " + storage_obj.id;
336
330
  return query;
337
331
  }
@@ -342,11 +336,8 @@ function updateStorageMySQL(id_device, storage_obj) {
342
336
  query += "storage_type = :tipo, ";
343
337
  query += "storage_size_unit = :unita, ";
344
338
  query += "storage_totsize = :dimensione, ";
345
- query += "storage_available = :dim_disponibile ";
346
339
  query += "storage_manifacturer = :marca, ";
347
- query += "storage_model = :modello, ";
348
- query += "is_replaced = :is_replaced, ";
349
- query += "date_replaced = :date_replaced ";
340
+ query += "storage_model = :modello ";
350
341
  query += "where id = id_storage";
351
342
  return query;
352
343
  }
@@ -373,7 +364,7 @@ function removeStorageSQLite(id_device, storage_obj) {
373
364
 
374
365
  function removeStorageMySQL(id_device, storage_obj) {
375
366
  var query = "delete from device_storages ";
376
- query += "where id = id_storage";
367
+ query += "where id = :id_storage";
377
368
  return query;
378
369
  }
379
370
  function removeStorage(db_used, id_device, storage_obj) {
@@ -392,14 +383,14 @@ function removeStorage(db_used, id_device, storage_obj) {
392
383
  }
393
384
  //
394
385
  function getStoragesByConfigSQLite(id_device, id_conf) {
395
- var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
386
+ 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 ";
396
387
  query += "join storage_types st on st.id = ds.storage_type ";
397
388
  query += "where id_device = " + id_device + " ";
398
389
  query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
399
390
  return query;
400
391
  }
401
392
  function getStoragesByConfigMySQL(id_device, id_conf) {
402
- var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
393
+ 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 ";
403
394
  query += "join storage_types st on st.id = ds.storage_type ";
404
395
  query += "where id_device = :id_device ";
405
396
  query += "and ds.id in (select id_part from change_config where id_conf = :id_conf)";
@@ -1255,10 +1246,16 @@ function getDiskUsageById(db_used, id_diskusage) {
1255
1246
 
1256
1247
 
1257
1248
  function insertDiskUsageSQLite(id_device, id_storage, date_ref, size_unit, available_space) {
1249
+ var dr = date_ref;
1250
+ var dr_str = "";
1251
+ if (dr) {
1252
+ var d = new Date(dr);
1253
+ dr_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
1254
+ }
1258
1255
  var query = "insert into disk_usage (id_device, id_storage, date_ref, size_unit, available_space) values (";
1259
1256
  query += id_device + ", ";
1260
1257
  query += id_storage + ", ";
1261
- query += "'" + date_ref + "', ";
1258
+ query += "'" + dr_str + "', ";
1262
1259
  query += "'" + size_unit + "', ";
1263
1260
  query += available_space + ")";
1264
1261
  return query;
@@ -1291,7 +1288,13 @@ function insertDiskUsage(db_used, id_device, id_storage, date_ref, size_unit, av
1291
1288
 
1292
1289
  function updateDiskUsageSQLite(id_diskusage, date_ref, size_unit, available_space) {
1293
1290
  var query = "update disk_usage set ";
1294
- query += "date_ref = '" + date_ref + "', ";
1291
+ var dr = date_ref;
1292
+ var dr_str = "";
1293
+ if (dr) {
1294
+ var d = new Date(dr);
1295
+ dr_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
1296
+ }
1297
+ query += "date_ref = '" + dr_str + "', ";
1295
1298
  query += "size_unit = '" + size_unit + "', ";
1296
1299
  query += "available_space = " + available_space + " ";
1297
1300
  query += "where id = " + id_diskusage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.81",
3
+ "version": "1.0.83",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",