alsmanager_lib 1.0.81 → 1.0.82

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
@@ -288,21 +288,19 @@ function createStorageObjMySQL(id_device, storage_obj) {
288
288
  obj.dim_disponibile = storage_obj.dim_disponibile;
289
289
  obj.marca = storage_obj.marca;
290
290
  obj.modello = storage_obj.modello;
291
- obj.is_replaced = storage_obj.is_replaced;
292
- obj.date_replaced = storage_obj.date_replaced;
293
291
  return obj;
294
292
  }
295
293
 
296
294
  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 ";
295
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model) values ";
298
296
  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 + "')";
297
+ query += "'" + storage_obj.marca + "', '" + storage_obj.modello + "')";
300
298
  return query;
301
299
  }
302
300
 
303
301
  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)";
302
+ var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model) values ";
303
+ query += "(:id_device, :tipo, :unita, :dimensione, :dim_disponibile, :marca, :modello)";
306
304
  return query;
307
305
  }
308
306
 
@@ -329,9 +327,7 @@ function updateStorageSQLite(id_device, storage_obj) {
329
327
  query += "storage_totsize = " + storage_obj.dimensione + ", ";
330
328
  query += "storage_available = " + storage_obj.dim_disponibile + ", ";
331
329
  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 + "' ";
330
+ query += "storage_model = '" + storage_obj.modello + "' ";
335
331
  query += "where id = " + storage_obj.id;
336
332
  return query;
337
333
  }
@@ -344,9 +340,7 @@ function updateStorageMySQL(id_device, storage_obj) {
344
340
  query += "storage_totsize = :dimensione, ";
345
341
  query += "storage_available = :dim_disponibile ";
346
342
  query += "storage_manifacturer = :marca, ";
347
- query += "storage_model = :modello, ";
348
- query += "is_replaced = :is_replaced, ";
349
- query += "date_replaced = :date_replaced ";
343
+ query += "storage_model = :modello ";
350
344
  query += "where id = id_storage";
351
345
  return query;
352
346
  }
@@ -1255,10 +1249,16 @@ function getDiskUsageById(db_used, id_diskusage) {
1255
1249
 
1256
1250
 
1257
1251
  function insertDiskUsageSQLite(id_device, id_storage, date_ref, size_unit, available_space) {
1252
+ var dr = date_ref;
1253
+ var dr_str = "";
1254
+ if (dr) {
1255
+ var d = new Date(dr);
1256
+ dr_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
1257
+ }
1258
1258
  var query = "insert into disk_usage (id_device, id_storage, date_ref, size_unit, available_space) values (";
1259
1259
  query += id_device + ", ";
1260
1260
  query += id_storage + ", ";
1261
- query += "'" + date_ref + "', ";
1261
+ query += "'" + dr_str + "', ";
1262
1262
  query += "'" + size_unit + "', ";
1263
1263
  query += available_space + ")";
1264
1264
  return query;
@@ -1291,7 +1291,13 @@ function insertDiskUsage(db_used, id_device, id_storage, date_ref, size_unit, av
1291
1291
 
1292
1292
  function updateDiskUsageSQLite(id_diskusage, date_ref, size_unit, available_space) {
1293
1293
  var query = "update disk_usage set ";
1294
- query += "date_ref = '" + date_ref + "', ";
1294
+ var dr = date_ref;
1295
+ var dr_str = "";
1296
+ if (dr) {
1297
+ var d = new Date(dr);
1298
+ dr_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
1299
+ }
1300
+ query += "date_ref = '" + dr_str + "', ";
1295
1301
  query += "size_unit = '" + size_unit + "', ";
1296
1302
  query += "available_space = " + available_space + " ";
1297
1303
  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.82",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",