fixed backend imports

This commit is contained in:
2024-02-16 19:00:30 +01:00
parent 5ca56d36cf
commit 5242d4a3af
26 changed files with 195 additions and 279 deletions

View File

@ -17,7 +17,7 @@ export const getConfigItems = async (result) => {
//get single config item by id
export const getConfigItemById = async (id, result) => {
try {
let sql = `SELECT * FROM changeDB WHERE primaryID = ?`;
let sql = `SELECT * FROM changedb WHERE primaryID = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -31,7 +31,7 @@ export const getConfigItemById = async (id, result) => {
//get single config item by name
export const getConfigItemByName = async (name, result) => {
try {
let sql = `SELECT * FROM changeDB WHERE assetName = ?`;
let sql = `SELECT * FROM changedb WHERE assetName = ?`;
const results = await ownConn.query(sql, [name])
result(null, results[0]);
}
@ -45,7 +45,7 @@ export const getConfigItemByName = async (name, result) => {
//get config items by customer id
export const getConfigItemByCustomerId = async (customerId, result) => {
try {
let sql = `SELECT * FROM changeDB WHERE customerID = ? ORDER BY assetName ASC`;
let sql = `SELECT * FROM changedb WHERE customerID = ? ORDER BY assetName ASC`;
const results = await ownConn.query(sql, [customerId])
result(null, results);
}
@ -60,7 +60,7 @@ export const getConfigItemByCustomerId = async (customerId, result) => {
export const updateConfigItemById = async (data, result) => {
const id = data.primaryID;
try {
let sql = `UPDATE changeDB SET assetName = ?, customerID = ?, customer = ?, location = ?, remoteLocation = ?, type = ?, description = ?, notes = ?, state = ?, lastView = ?, user = ?, hardwareBool = ?, model = ?, serialnumber = ?, CPU = ?, RAM = ?, storageConfiguration = ?, miscellaneous = ?, softwareBool = ?, software = ?, version = ?, networkBool = ?, IPv4 = ?, IPv6 = ?, MAC = ?, subnetmask = ? WHERE primaryID = ?`;
let sql = `UPDATE changedb SET assetName = ?, customerID = ?, customer = ?, location = ?, remoteLocation = ?, type = ?, description = ?, notes = ?, state = ?, lastView = ?, user = ?, hardwareBool = ?, model = ?, serialnumber = ?, CPU = ?, RAM = ?, storageConfiguration = ?, miscellaneous = ?, softwareBool = ?, software = ?, version = ?, networkBool = ?, IPv4 = ?, IPv6 = ?, MAC = ?, subnetmask = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.assetName, data.customerID, data.customer, data.location, data.remoteLocation, data.type, data.description, data.notes, data.state, data.lastView, data.user, data.hardwareBool, data.model, data.serialnumber, data.CPU, data.RAM, data.storageConfiguration, data.miscellaneous, data.softwareBool, data.software, data.version, data.license, data.networkBool, data.IPv4, data.IPv6, data.MAC, data.subnetmask, id]);
result(null, results);
}
@ -74,7 +74,7 @@ export const updateConfigItemById = async (data, result) => {
//insert config item to databased
export const insertConfigItem = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO changeDB(assetName, customerID, customer, location, remoteLocation, type, description, notes, state, lastView, user, hardwareBool, model, serialnumber, CPU, RAM, storageConfiguration, miscellaneous, softwareBool, software, version, license, networkBool, IPv4, IPv6, MAC, subnetmask) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.assetName, data.customerID, data.customer, data.location, data.remoteLocation, data.type, data.description, data.notes, data.state, data.lastView, data.user, data.hardwareBool, data.model, data.serialnumber, data.CPU, data.RAM, data.storageConfiguration, data.miscellaneous, data.softwareBool, data.software, data.version, data.license, data.networkBool, data.IPv4, data.IPv6, data.MAC, data.subnetmask])
const results = await ownConn.query(`INSERT INTO changedb(assetName, customerID, customer, location, remoteLocation, type, description, notes, state, lastView, user, hardwareBool, model, serialnumber, CPU, RAM, storageConfiguration, miscellaneous, softwareBool, software, version, license, networkBool, IPv4, IPv6, MAC, subnetmask) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.assetName, data.customerID, data.customer, data.location, data.remoteLocation, data.type, data.description, data.notes, data.state, data.lastView, data.user, data.hardwareBool, data.model, data.serialnumber, data.CPU, data.RAM, data.storageConfiguration, data.miscellaneous, data.softwareBool, data.software, data.version, data.license, data.networkBool, data.IPv4, data.IPv6, data.MAC, data.subnetmask])
result(null, results);
}
catch (err) {
@ -87,7 +87,7 @@ export const insertConfigItem = async (data, result) => {
//get all selected config items by customer
export const getSelectedConfigItemsByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM changeDB WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM changedb WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -101,7 +101,7 @@ export const getSelectedConfigItemsByCustomer = async (selected, result) => {
//get all selected config items by asset name
export const getSelectedConfigItemsByAssetName = async (selected, result) => {
try {
let sql = `SELECT * FROM changeDB WHERE assetName LIKE '%${selected}%' ORDER BY assetName ASC`;
let sql = `SELECT * FROM changedb WHERE assetName LIKE '%${selected}%' ORDER BY assetName ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -115,7 +115,7 @@ export const getSelectedConfigItemsByAssetName = async (selected, result) => {
// Delete config item to Database
export const deleteConfigItemById = async (id, result) => {
try {
let sql = `DELETE FROM changeDB WHERE primaryID = ?`;
let sql = `DELETE FROM changedb WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}