alsmanager_lib 3.0.8 → 3.0.10
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.
- package/lib/modules.js +107 -2
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -2088,9 +2088,110 @@ function getPCPropertiesByConfig(db_used, id_device, id_conf) {
|
|
|
2088
2088
|
return query;
|
|
2089
2089
|
}
|
|
2090
2090
|
//End Manage PC Properties
|
|
2091
|
+
// Switch/Patch Properties
|
|
2092
|
+
function getSwitchPatchPropertiesSQLite(id_device) {
|
|
2093
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
2094
|
+
query += "ds.num_ports as NumeroPorte ";
|
|
2095
|
+
query += "from devices d ";
|
|
2096
|
+
query += "left join device_switch ds on d.id = ds.id_device ";
|
|
2097
|
+
query += "where d.id = " + id_device;
|
|
2098
|
+
return query;
|
|
2099
|
+
}
|
|
2100
|
+
function getSwitchPatchPropertiesMySQL(id_device) {
|
|
2101
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
2102
|
+
query += "ds.num_ports as NumeroPorte ";
|
|
2103
|
+
query += "from devices d ";
|
|
2104
|
+
query += "left join device_switch ds on d.id = ds.id_device ";
|
|
2105
|
+
query += "where d.id = :id_device";
|
|
2106
|
+
return query;
|
|
2107
|
+
}
|
|
2108
|
+
function getSwitchPatchProperties(db_used, id_device) {
|
|
2109
|
+
var query = "";
|
|
2110
|
+
if (db_used) {
|
|
2111
|
+
switch (db_used) {
|
|
2112
|
+
case 'SQLITE':
|
|
2113
|
+
query = getSwitchPatchPropertiesSQLite(id_device);
|
|
2114
|
+
break;
|
|
2115
|
+
case 'MYSQL':
|
|
2116
|
+
query = getSwitchPatchPropertiesMySQL(id_device);
|
|
2117
|
+
break;
|
|
2118
|
+
case 'MYSQL2':
|
|
2119
|
+
query = getSwitchPatchPropertiesSQLite(id_device);
|
|
2120
|
+
break;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
return query;
|
|
2124
|
+
}
|
|
2125
|
+
function createSwitchPatchPropertiesMySQLObj(id_device, dev_prop) {
|
|
2126
|
+
var obj = {};
|
|
2127
|
+
obj.id_device = id_device;
|
|
2128
|
+
obj.num_ports = dev_prop.num_ports;
|
|
2129
|
+
return obj;
|
|
2130
|
+
}
|
|
2131
|
+
function insertSwitchPatchPropertiesSQLite(id_device, dev_prop) {
|
|
2132
|
+
var query = "insert into device_switch (id_device, num_ports) values ";
|
|
2133
|
+
query += "(" + id_device + ", '" + dev_prop.num_ports + ")";
|
|
2134
|
+
return query;
|
|
2135
|
+
}
|
|
2136
|
+
function insertSwitchPatchPropertiesMySQL() {
|
|
2137
|
+
var query = "insert into device_switch (id_device, num_ports) values ";
|
|
2138
|
+
query += "(:id_device, :num_ports)";
|
|
2139
|
+
}
|
|
2140
|
+
function insertSwitchPatchProperties(db_used, id_device, dev_prop) {
|
|
2141
|
+
var query = "";
|
|
2142
|
+
if (db_used) {
|
|
2143
|
+
switch (db_used) {
|
|
2144
|
+
case 'SQLITE':
|
|
2145
|
+
query = insertSwitchPatchPropertiesSQLite(id_device, dev_prop);
|
|
2146
|
+
break;
|
|
2147
|
+
case 'MYSQL':
|
|
2148
|
+
query = insertSwitchPatchPropertiesMySQL();
|
|
2149
|
+
break;
|
|
2150
|
+
case 'MYSQL2':
|
|
2151
|
+
query = insertSwitchPatchPropertiesSQLite(id_device, dev_prop);
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
return query;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
function updateSwitchPatchPropertiesSQLite(id_device, dev_prop) {
|
|
2159
|
+
var query = "update device_pc set ";
|
|
2160
|
+
query += "id_device = " + id_device + ", ";
|
|
2161
|
+
query += "num_ports = " + dev_prop.num_ports + " ";
|
|
2162
|
+
query += "where id_device = " + id_device;
|
|
2163
|
+
return query;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
function updateSwitchPatchPropertiesMySQL() {
|
|
2167
|
+
var query = "update device_pc set ";
|
|
2168
|
+
query += "id_device = :id_device, ";
|
|
2169
|
+
query += "num_ports = :num_ports ";
|
|
2170
|
+
query += "where id_device = :id_device";
|
|
2171
|
+
return query;
|
|
2172
|
+
}
|
|
2173
|
+
function updateSwitchPatchProperties(db_used, id_device, dev_prop) {
|
|
2174
|
+
var query = "";
|
|
2175
|
+
if (db_used) {
|
|
2176
|
+
switch (db_used) {
|
|
2177
|
+
case 'SQLITE':
|
|
2178
|
+
query = updateSwitchPatchPropertiesSQLite(id_device, dev_prop);
|
|
2179
|
+
break;
|
|
2180
|
+
case 'MYSQL':
|
|
2181
|
+
query = updateSwitchPatchPropertiesMySQL();
|
|
2182
|
+
break;
|
|
2183
|
+
case 'MYSQL2':
|
|
2184
|
+
query = updateSwitchPatchPropertiesSQLite(id_device, dev_prop);
|
|
2185
|
+
break;
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
return query;
|
|
2189
|
+
}
|
|
2190
|
+
//End Switch/Patch Properties
|
|
2191
|
+
|
|
2091
2192
|
// Manage Display Part Properties
|
|
2092
2193
|
function getDisplayPartPropertiesSQLite(id_device) {
|
|
2093
|
-
var query = "select d.id as Id, ";
|
|
2194
|
+
var query = "select d.id as Id, dm.id as id_prop, ";
|
|
2094
2195
|
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch, dm.is_removable as Removibile ";
|
|
2095
2196
|
query += "from devices d ";
|
|
2096
2197
|
query += "left join display_part dm on d.id = dm.id_device ";
|
|
@@ -2098,7 +2199,7 @@ function getDisplayPartPropertiesSQLite(id_device) {
|
|
|
2098
2199
|
return query;
|
|
2099
2200
|
}
|
|
2100
2201
|
function getDisplayPartPropertiesMySQL(id_device) {
|
|
2101
|
-
var query = "select d.id as Id, ";
|
|
2202
|
+
var query = "select d.id as Id, dm.id as id_prop, ";
|
|
2102
2203
|
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch, dm.is_removable as Removibile ";
|
|
2103
2204
|
query += "from devices d ";
|
|
2104
2205
|
query += "left join display_part dm on d.id = dm.id_device ";
|
|
@@ -12990,6 +13091,10 @@ module.exports = {
|
|
|
12990
13091
|
updatePCProperties,
|
|
12991
13092
|
getLastPCPropertiesInserted,
|
|
12992
13093
|
getPCPropertiesByConfig,
|
|
13094
|
+
getSwitchPatchProperties,
|
|
13095
|
+
createSwitchPatchPropertiesMySQLObj,
|
|
13096
|
+
insertSwitchPatchProperties,
|
|
13097
|
+
updateSwitchPatchProperties,
|
|
12993
13098
|
existsDisplayProperties,
|
|
12994
13099
|
getDisplayProperties,
|
|
12995
13100
|
createDisplayPropertiesMySQLObj,
|