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

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//insert checklist solution todo to databased
export const insertChecklistSolutionTodo = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO checklistSolutions(solutionID, step, asset, task, comments) VALUES(?, ?, ?, ?, ?)`, [data.solutionID, data.step, data.asset, data.task, data.comments]);
const results = await ownConn.query(`INSERT INTO checklistsolutions(solutionID, step, asset, task, comments) VALUES(?, ?, ?, ?, ?)`, [data.solutionID, data.step, data.asset, data.task, data.comments]);
result(null, results);
}
catch (err) {
@ -16,7 +16,7 @@ export const insertChecklistSolutionTodo = async (data, result) => {
//get single checklist solution todo by id
export const getChecklistSolutionTodosById = async (id, result) => {
try {
let sql = `SELECT * FROM checklistSolutions WHERE solutionID = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM checklistsolutions WHERE solutionID = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -30,7 +30,7 @@ export const getChecklistSolutionTodosById = async (id, result) => {
//get single checklist solution todo by asset
export const getChecklistSolutionTodosByAsset = async (id, result) => {
try {
let sql = `SELECT * FROM checklistSolutions WHERE asset = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM checklistsolutions WHERE asset = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -45,7 +45,7 @@ export const getChecklistSolutionTodosByAsset = async (id, result) => {
export const updateChecklistSolutionTodoById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE checklistSolutions SET step = ?, asset = ?, task = ?, comments = ? WHERE primaryID = ?`;
let sql = `UPDATE checklistsolutions SET step = ?, asset = ?, task = ?, comments = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.step, data.asset, data.task, data.comments, id])
result(null, results);
}
@ -59,7 +59,7 @@ export const updateChecklistSolutionTodoById = async (data, result) => {
// Delete all checklist solution todos by template ID to Database
export const deleteAllChecklistSolutionTodosSolutionID = async (id, result) => {
try {
let sql = `DELETE FROM checklistSolutions WHERE solutionID = ?`;
let sql = `DELETE FROM checklistsolutions WHERE solutionID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -73,7 +73,7 @@ export const deleteAllChecklistSolutionTodosSolutionID = async (id, result) => {
// Delete single checklist solution todo by primary ID to Database
export const deleteChecklistSolutionTodo = async (id, result) => {
try {
let sql = `DELETE FROM checklistSolutions WHERE primaryID = ?`;
let sql = `DELETE FROM checklistsolutions WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}

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);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all issue slips
export const getIssueSlips = async (result) => {
try {
let sql = `SELECT * FROM issueSlips ORDER BY customer ASC`;
let sql = `SELECT * FROM issueslips ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getIssueSlips = async (result) => {
//get all selected issue slips by ticketnumber
export const getSelectedIssueSlipsByTicketnumber = async (selected, result) => {
try {
let sql = `SELECT * FROM issueSlips WHERE ticketNo LIKE '%${selected}%' ORDER BY ticketNo ASC`;
let sql = `SELECT * FROM issueslips WHERE ticketNo LIKE '%${selected}%' ORDER BY ticketNo ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -31,7 +31,7 @@ export const getSelectedIssueSlipsByTicketnumber = async (selected, result) => {
//get all selected issue slips by customer
export const getSelectedIssueSlipsByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM issueSlips WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM issueslips WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedIssueSlipsByCustomer = async (selected, result) => {
//get all selected issue slips by date of creation
export const getSelectedIssueSlipsByDate = async (selected, result) => {
try {
let sql = `SELECT * FROM issueSlips WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
let sql = `SELECT * FROM issueslips WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -59,7 +59,7 @@ export const getSelectedIssueSlipsByDate = async (selected, result) => {
// Delete issue slip to Database
export const deleteIssueSlipById = async (id, result) => {
try {
let sql = `DELETE FROM issueSlips WHERE primaryID = ?`;
let sql = `DELETE FROM issueslips WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -73,7 +73,7 @@ export const deleteIssueSlipById = async (id, result) => {
// Delete issue slip by ticketnumber to Database
export const deleteIssueSlipByTicketNo = async (id, result) => {
try {
let sql = `DELETE FROM issueSlips WHERE ticketNo = ?`;
let sql = `DELETE FROM issueslips WHERE ticketNo = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -87,7 +87,7 @@ export const deleteIssueSlipByTicketNo = async (id, result) => {
//insert issue slip to database
export const insertIssueSlip = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO issueSlips(customerID, customer, ticketNo, creationDate, lastView, user, notes, supplierRequest, supplierOffer, clientOffer, clientOrder, supplierOrder, ingress, egress, ingressBill, egressBill) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.customerID, data.customer, data.ticketNo, data.creationDate, data.lastView, data.user, data.notes, data.supplierRequest, data.supplierOffer, data.clientOffer, data.clientOrder, data.supplierOrder, data.ingress, data.egress, data.ingressBill, data.egressBill])
const results = await ownConn.query(`INSERT INTO issueslips(customerID, customer, ticketNo, creationDate, lastView, user, notes, supplierRequest, supplierOffer, clientOffer, clientOrder, supplierOrder, ingress, egress, ingressBill, egressBill) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.customerID, data.customer, data.ticketNo, data.creationDate, data.lastView, data.user, data.notes, data.supplierRequest, data.supplierOffer, data.clientOffer, data.clientOrder, data.supplierOrder, data.ingress, data.egress, data.ingressBill, data.egressBill])
result(null, results);
}
catch (err) {
@ -100,7 +100,7 @@ export const insertIssueSlip = async (data, result) => {
//get single issue slip by ticketNo
export const getIssueSlipByTicketNo = async (id, result) => {
try {
let sql = `SELECT * FROM issueSlips WHERE ticketNo = ?`;
let sql = `SELECT * FROM issueslips WHERE ticketNo = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -114,7 +114,7 @@ export const getIssueSlipByTicketNo = async (id, result) => {
//get single issue slip by id
export const getIssueSlipById = async (id, result) => {
try {
let sql = `SELECT * FROM issueSlips WHERE primaryID = ?`;
let sql = `SELECT * FROM issueslips WHERE primaryID = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -129,7 +129,7 @@ export const getIssueSlipById = async (id, result) => {
export const updateIssueSlipById = async (data, result) => {
const id = data.primaryID;
try {
let sql = `UPDATE issueSlips SET customerID = ?, customer = ?, ticketNo = ?, creationDate = ?, lastView = ?, user = ?, notes = ?, supplierRequest = ?, supplierOffer = ?, clientOffer = ?, clientOrder = ?, supplierOrder = ?, ingress = ?, egress = ?, ingressBill = ?, egressBill = ? WHERE primaryID = ?`;
let sql = `UPDATE issueslips SET customerID = ?, customer = ?, ticketNo = ?, creationDate = ?, lastView = ?, user = ?, notes = ?, supplierRequest = ?, supplierOffer = ?, clientOffer = ?, clientOrder = ?, supplierOrder = ?, ingress = ?, egress = ?, ingressBill = ?, egressBill = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.customerID, data.customer, data.ticketNo, data.creationDate, data.lastView, data.user, data.notes, data.supplierRequest, data.supplierOffer, data.clientOffer, data.clientOrder, data.supplierOrder, data.ingress, data.egress, data.ingressBill, data.egressBill, id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all issue variants
export const getAllIssueVariants = async (result) => {
try {
let sql = `SELECT * FROM issueVariants ORDER BY primaryID ASC`;
let sql = `SELECT * FROM issuevariants ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getAllIssueVariants = async (result) => {
//get issue variant
export const getIssueVariantById = async (id, result) => {
try {
let sql = `SELECT * FROM issueVariants WHERE primaryID = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM issuevariants WHERE primaryID = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -31,7 +31,7 @@ export const getIssueVariantById = async (id, result) => {
//get all selected issue variants by issueID
export const getSelectedIssueVariantsByIssueId = async (selected, result) => {
try {
let sql = `SELECT * FROM issueVariants WHERE issueID LIKE '%${selected}%' ORDER BY issueID ASC`;
let sql = `SELECT * FROM issuevariants WHERE issueID LIKE '%${selected}%' ORDER BY issueID ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedIssueVariantsByIssueId = async (selected, result) => {
//get all selected issue variants by name
export const getSelectedIssueVariantsByName = async (selected, result) => {
try {
let sql = `SELECT * FROM issueVariants WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
let sql = `SELECT * FROM issuevariants WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -60,7 +60,7 @@ export const getSelectedIssueVariantsByName = async (selected, result) => {
export const updateIssueVariantById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE issueVariants SET issueID = ?, name = ? , properties = ?, state = ?, amount = ?, price = ? WHERE primaryID = ?`;
let sql = `UPDATE issuevariants SET issueID = ?, name = ? , properties = ?, state = ?, amount = ?, price = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.issueID, data.name, data.properties, data.state, data.amount, data.price, id])
result(null, results);
}
@ -75,7 +75,7 @@ export const updateIssueVariantById = async (data, result) => {
// Delete issue variant to Database
export const deleteIssueVariantById = async (id, result) => {
try {
let sql = `DELETE FROM issueVariants WHERE primaryID = ?`;
let sql = `DELETE FROM issuevariants WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -89,7 +89,7 @@ export const deleteIssueVariantById = async (id, result) => {
// Delete issue variants by issueID to Database
export const deleteIssueVariantByIssueSlipId = async (id, result) => {
try {
let sql = `DELETE FROM issueVariants WHERE issueID = ?`;
let sql = `DELETE FROM issuevariants WHERE issueID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -103,7 +103,7 @@ export const deleteIssueVariantByIssueSlipId = async (id, result) => {
//insert issue to databased
export const insertIssueVariant = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO issueVariants(issueID, name, properties, state, amount, price) VALUES(?, ?, ?, ?, ?, ?)`, [data.issueID, data.name, data.properties, data.state, data.amount, data.price])
const results = await ownConn.query(`INSERT INTO issuevariants(issueID, name, properties, state, amount, price) VALUES(?, ?, ?, ?, ?, ?)`, [data.issueID, data.name, data.properties, data.state, data.amount, data.price])
result(null, results);
}
catch (err) {

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all maintenance visits
export const getMaintenanceVisits = async (result) => {
try {
let sql = `SELECT * FROM maintenanceVisits ORDER BY name ASC`;
let sql = `SELECT * FROM maintenancevisits ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getMaintenanceVisits = async (result) => {
//get all selected maintenance visits by checklistname
export const getSelectedMaintenanceVisitsByChecklistname = async (selected, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
let sql = `SELECT * FROM maintenancevisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -31,7 +31,7 @@ export const getSelectedMaintenanceVisitsByChecklistname = async (selected, resu
//get all selected maintenance visits by customer
export const getSelectedMaintenanceVisitsByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM maintenancevisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedMaintenanceVisitsByCustomer = async (selected, result) =
//get all selected maintenance visits by date
export const getSelectedMaintenanceVisitsByDate = async (selected, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
let sql = `SELECT * FROM maintenancevisits WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
const results = await ownConn.execute(sql);
result(null, results);
}
@ -59,7 +59,7 @@ export const getSelectedMaintenanceVisitsByDate = async (selected, result) => {
//get all selected maintenance visits by state
export const getSelectedMaintenanceVisitsByState = async (selected, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE state LIKE '%${selected}%' ORDER BY state ASC`;
let sql = `SELECT * FROM maintenancevisits WHERE state LIKE '%${selected}%' ORDER BY state ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -73,7 +73,7 @@ export const getSelectedMaintenanceVisitsByState = async (selected, result) => {
// Delete maintenance visit to Database
export const deleteMaintenanceVisitById = async (id, result) => {
try {
let sql = `DELETE FROM maintenanceVisits WHERE primaryID = ?`;
let sql = `DELETE FROM maintenancevisits WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -87,7 +87,7 @@ export const deleteMaintenanceVisitById = async (id, result) => {
//insert maintenance visit to databased
export const insertMaintenanceVisit = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO maintenanceVisits(name, templateID, maintenanceType, state, creationDate, completionDate, user, customer, customerID, templateNotes, type, timeSpent, notes) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.name, data.templateID, data.maintenanceType, data.state, data.creationDate, data.completionDate, data.user, data.customer, data.customerID, data.templateNotes, data.type, data.timeSpent, data.notes])
const results = await ownConn.query(`INSERT INTO maintenancevisits(name, templateID, maintenanceType, state, creationDate, completionDate, user, customer, customerID, templateNotes, type, timeSpent, notes) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.name, data.templateID, data.maintenanceType, data.state, data.creationDate, data.completionDate, data.user, data.customer, data.customerID, data.templateNotes, data.type, data.timeSpent, data.notes])
result(null, results);
}
catch (err) {
@ -100,7 +100,7 @@ export const insertMaintenanceVisit = async (data, result) => {
//get single maintenance visit by name
export const getMaintenanceVisitByName = async (id, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE name = ?`;
let sql = `SELECT * FROM maintenancevisits WHERE name = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -114,7 +114,7 @@ export const getMaintenanceVisitByName = async (id, result) => {
//get single maintenance visit by id
export const getMaintenanceVisitById = async (id, result) => {
try {
let sql = `SELECT * FROM maintenanceVisits WHERE primaryID = ?`;
let sql = `SELECT * FROM maintenancevisits WHERE primaryID = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -129,7 +129,7 @@ export const getMaintenanceVisitById = async (id, result) => {
export const updateMaintenanceVisitStateById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE maintenanceVisits SET state = ? WHERE primaryID = ?`;
let sql = `UPDATE maintenancevisits SET state = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.state, id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//insert maintenance visit todo to databased
export const insertMaintenanceVisitTodo = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO maintenanceVisitTodos(templateID, step, asset, task, comment, done) VALUES(?, ?, ?, ?, ?, ?)`, [data.templateID, data.step, data.asset, data.task, data.comment, data.done])
const results = await ownConn.query(`INSERT INTO maintenancevisittodos(templateID, step, asset, task, comment, done) VALUES(?, ?, ?, ?, ?, ?)`, [data.templateID, data.step, data.asset, data.task, data.comment, data.done])
result(null, results);
}
catch (err) {
@ -16,7 +16,7 @@ export const insertMaintenanceVisitTodo = async (data, result) => {
//get single maintenance visit todo by id
export const getMaintenanceVisitTodosById = async (id, result) => {
try {
let sql = `SELECT * FROM maintenanceVisitTodos WHERE templateID = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM maintenancevisittodos WHERE templateID = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -30,7 +30,7 @@ export const getMaintenanceVisitTodosById = async (id, result) => {
//get single maintenance visit todo by asset
export const getMaintenanceVisitTodosByAsset = async (id, result) => {
try {
let sql = `SELECT * FROM maintenanceVisitTodos WHERE asset = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM maintenancevisittodos WHERE asset = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -45,7 +45,7 @@ export const getMaintenanceVisitTodosByAsset = async (id, result) => {
export const updateMaintenanceVisitTodoById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE maintenanceVisitTodos SET step = ?, asset = ?, task = ?, comment = ?, done = ? WHERE primaryID = ?`;
let sql = `UPDATE maintenancevisittodos SET step = ?, asset = ?, task = ?, comment = ?, done = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.step, data.asset, data.task, data.comment, id])
result(null, results);
}
@ -59,7 +59,7 @@ export const updateMaintenanceVisitTodoById = async (data, result) => {
// Delete maintenance visit todo to Database
export const deleteMaintenanceVisitTodosByPrimaryID = async (id, result) => {
try {
let sql = `DELETE FROM maintenanceVisitTodos WHERE primaryID = ?`;
let sql = `DELETE FROM maintenancevisittodos WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get single master maintenance visit todo
export const getMasterMaintenanceVisitTodoById = async (id, result) => {
try {
let sql = `SELECT * FROM masterMaintenanceVisitTodos WHERE templateID = ? ORDER BY rowID ASC`;
let sql = `SELECT * FROM mastermaintenancetodos WHERE templateID = ? ORDER BY rowID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -18,7 +18,7 @@ export const getMasterMaintenanceVisitTodoById = async (id, result) => {
export const updateMasterMaintenanceVisitTodoById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE masterMaintenanceVisitTodos SET templateID = ?, asset = ? , task = ?, comments = ? WHERE primaryID = ?`;
let sql = `UPDATE mastermaintenancetodos SET templateID = ?, asset = ? , task = ?, comments = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.templateID, data.asset, data.task, data.comments, id])
result(null, results);
}
@ -33,7 +33,7 @@ export const updateMasterMaintenanceVisitTodoById = async (data, result) => {
// Delete master maintenance visit todo to Database
export const deleteMasterMaintenanceVisitTodoById = async (id, result) => {
try {
let sql = `DELETE FROM masterMaintenanceVisitTodos WHERE primaryID = ?`;
let sql = `DELETE FROM mastermaintenancetodos WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -47,7 +47,7 @@ export const deleteMasterMaintenanceVisitTodoById = async (id, result) => {
// Delete master maintenance visit todo by templateID to Database
export const deleteMasterMaintenanceVisitTodoByTemplateId = async (id, result) => {
try {
let sql = `DELETE FROM masterMaintenanceVisitTodos WHERE templateID = ?`;
let sql = `DELETE FROM mastermaintenancetodos WHERE templateID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -61,7 +61,7 @@ export const deleteMasterMaintenanceVisitTodoByTemplateId = async (id, result) =
// Update all master maintenance visit todos to Database
export const updateMasterMaintenanceVisitTodos = async (data, result) => {
try {
let sql = `UPDATE masterMaintenanceVisitTodos SET rowID = ? WHERE primaryID = ?`;
let sql = `UPDATE mastermaintenancetodos SET rowID = ? WHERE primaryID = ?`;
data.data.forEach(async i => {
let id = i.primaryID;
let rowId = i.rowID;
@ -79,7 +79,7 @@ export const updateMasterMaintenanceVisitTodos = async (data, result) => {
//insert master maintenance visit todo to databased
export const insertMasterMaintenanceVisitTodo = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO masterMaintenanceVisitTodos(templateID, rowID, asset, task, comments) VALUES(?, ?, ?, ?, ?)`, [data.templateID, data.rowID, data.asset, data.task, asset.comments])
const results = await ownConn.query(`INSERT INTO mastermaintenancetodos(templateID, rowID, asset, task, comments) VALUES(?, ?, ?, ?, ?)`, [data.templateID, data.rowID, data.asset, data.task, asset.comments])
result(null, results);
}
catch (err) {

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all master maintenance visits
export const getMasterMaintenanceVisits = async (result) => {
try {
let sql = `SELECT * FROM masterMaintenanceVisits ORDER BY name ASC`;
let sql = `SELECT * FROM mastermaintenancevisits ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getMasterMaintenanceVisits = async (result) => {
//get all selected master maintenance visits by customer
export const getSelectedMasterMaintenanceVisitsByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM masterMaintenanceVisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM mastermaintenancevisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -31,7 +31,7 @@ export const getSelectedMasterMaintenanceVisitsByCustomer = async (selected, res
//get all selected master maintenance visits by checklistname
export const getSelectedMasterMaintenanceVisitsByChecklistname = async (selected, result) => {
try {
let sql = `SELECT * FROM masterMaintenanceVisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
let sql = `SELECT * FROM mastermaintenancevisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedMasterMaintenanceVisitsByChecklistname = async (selected
//get single master maintenance visit
export const getMasterMaintenanceVisitById = async (id, result) => {
try {
let sql = `SELECT * FROM masterMaintenanceVisits WHERE checklistID = ?`;
let sql = `SELECT * FROM mastermaintenancevisits WHERE checklistID = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -60,7 +60,7 @@ export const getMasterMaintenanceVisitById = async (id, result) => {
export const updateMasterMaintenanceVisitById = async (data, result) => {
try {
const id = data.checklistID;
let sql = `UPDATE masterMaintenanceVisits SET name = ?, customerID = ? , customer = ?, type = ?, lastView = ?, user = ?, notes = ? WHERE checklistID = ?`;
let sql = `UPDATE mastermaintenancevisits SET name = ?, customerID = ? , customer = ?, type = ?, lastView = ?, user = ?, notes = ? WHERE checklistID = ?`;
const results = await ownConn.query(sql, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes, id])
result(null, results);
}
@ -74,7 +74,7 @@ export const updateMasterMaintenanceVisitById = async (data, result) => {
//insert master maintenance visit to databased
export const insertMasterMaintenanceVisit = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO masterMaintenanceVisits(name, customerID, customer, type, lastView, user, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes])
const results = await ownConn.query(`INSERT INTO mastermaintenancevisits(name, customerID, customer, type, lastView, user, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes])
result(null, results);
}
catch (err) {
@ -87,7 +87,7 @@ export const insertMasterMaintenanceVisit = async (data, result) => {
// Delete master maintenance visit to Database
export const deleteMasterMaintenanceVisitById = async (id, result) => {
try {
let sql = `DELETE FROM masterMaintenanceVisits WHERE checklistID = ?`;
let sql = `DELETE FROM mastermaintenancevisits WHERE checklistID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get single master production order todo
export const getMasterProductionOrderTodoById = async (id, result) => {
try {
let sql = `SELECT * FROM masterOrderTodos WHERE templateID = ? ORDER BY rowID ASC`;
let sql = `SELECT * FROM masterordertodos WHERE templateID = ? ORDER BY rowID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -18,7 +18,7 @@ export const getMasterProductionOrderTodoById = async (id, result) => {
export const updateMasterProductionOrderTodoById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE masterOrderTodos SET templateID = ?, asset = ? , task = ?, comment = ? WHERE primaryID = ?`;
let sql = `UPDATE masterordertodos SET templateID = ?, asset = ? , task = ?, comment = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.templateID, data.asset, data.task, data.comment, id])
result(null, results);
}
@ -33,7 +33,7 @@ export const updateMasterProductionOrderTodoById = async (data, result) => {
// Delete master production order todo to Database
export const deleteMasterProductionOrderTodoById = async (id, result) => {
try {
let sql = `DELETE FROM masterOrderTodos WHERE primaryID = ?`;
let sql = `DELETE FROM masterordertodos WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -47,7 +47,7 @@ export const deleteMasterProductionOrderTodoById = async (id, result) => {
// Delete master production order todo by templateID to Database
export const deleteMasterProductionOrderTodoByTemplateId = async (id, result) => {
try {
let sql = `DELETE FROM masterOrderTodos WHERE templateID = ?`;
let sql = `DELETE FROM masterordertodos WHERE templateID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -61,7 +61,7 @@ export const deleteMasterProductionOrderTodoByTemplateId = async (id, result) =>
// Update all master production order todos to Database
export const updateMasterProductionOrderTodos = async (data, result) => {
try {
let sql = `UPDATE masterOrderTodos SET rowID = ? WHERE primaryID = ?`;
let sql = `UPDATE masterordertodos SET rowID = ? WHERE primaryID = ?`;
data.data.forEach(async i => {
let id = i.primaryID;
let rowId = i.rowID;
@ -79,7 +79,7 @@ export const updateMasterProductionOrderTodos = async (data, result) => {
//insert master production order todo to databased
export const insertMasterProductionOrderTodo = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO masterOrderTodos(templateID, rowID, asset, task, comment) VALUES(?, ?, ?, ?, ?)`, [data.templateID, data.rowID, data.asset, data.task, data.comment])
const results = await ownConn.query(`INSERT INTO masterordertodos(templateID, rowID, asset, task, comment) VALUES(?, ?, ?, ?, ?)`, [data.templateID, data.rowID, data.asset, data.task, data.comment])
result(null, results);
}
catch (err) {

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all master production orders
export const getMasterProductionOrders = async (result) => {
try {
let sql = `SELECT * FROM masterProductionOrders ORDER BY name ASC`;
let sql = `SELECT * FROM masterproductionorders ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getMasterProductionOrders = async (result) => {
//get all selected master production orders by customer
export const getSelectedMasterProductionOrdersByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM masterProductionOrders WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM masterproductionorders WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -31,7 +31,7 @@ export const getSelectedMasterProductionOrdersByCustomer = async (selected, resu
//get all selected master production orders by checklistname
export const getSelectedMasterProductionOrdersByChecklistname = async (selected, result) => {
try {
let sql = `SELECT * FROM masterProductionOrders WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
let sql = `SELECT * FROM masterproductionorders WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedMasterProductionOrdersByChecklistname = async (selected,
//get single master production order
export const getMasterProductionOrderById = async (id, result) => {
try {
let sql = `SELECT * FROM masterProductionOrders WHERE templateID = ?`;
let sql = `SELECT * FROM masterproductionorders WHERE templateID = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -60,7 +60,7 @@ export const getMasterProductionOrderById = async (id, result) => {
export const updateMasterProductionOrderById = async (data, result) => {
try {
const id = data.templateID;
let sql = `UPDATE masterProductionOrders SET name = ?, customerID = ? , customer = ?, lastView = ?, user = ?, description = ?, notes = ? WHERE templateID = ?`;
let sql = `UPDATE masterproductionorders SET name = ?, customerID = ? , customer = ?, lastView = ?, user = ?, description = ?, notes = ? WHERE templateID = ?`;
const results = await ownConn.query(sql, [data.name, data.customerID, data.customer, data.lastView, data.user, data.description, data.notes, id])
result(null, results);
}
@ -74,7 +74,7 @@ export const updateMasterProductionOrderById = async (data, result) => {
//insert master production order to databased
export const insertMasterProductionOrder = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO masterProductionOrders(name, customerID, customer, lastView, user, description, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.lastView, data.user, data.description, data.notes])
const results = await ownConn.query(`INSERT INTO masterproductionorders(name, customerID, customer, lastView, user, description, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.lastView, data.user, data.description, data.notes])
result(null, results);
}
catch (err) {
@ -87,7 +87,7 @@ export const insertMasterProductionOrder = async (data, result) => {
// Delete master production order to Database
export const deleteMasterProductionOrderById = async (id, result) => {
try {
let sql = `DELETE FROM masterProductionOrders WHERE templateID = ?`;
let sql = `DELETE FROM masterproductionorders WHERE templateID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get single ordering info issue slip
export const getOrderingInfoIssueSlipById = async (id, result) => {
try {
let sql = `SELECT * FROM orderingInfoIssueSlips WHERE issueSlipID = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM orderinginfoissueslips WHERE issueSlipID = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -18,7 +18,7 @@ export const getOrderingInfoIssueSlipById = async (id, result) => {
export const updateOrderingInfoIssueSlipById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE orderingInfoIssueSlips SET issueSlipID = ?, article = ? , amount = ?, price = ?, comment = ? WHERE primaryID = ?`;
let sql = `UPDATE orderinginfoissueslips SET issueSlipID = ?, article = ? , amount = ?, price = ?, comment = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.issueSlipID, data.article, data.amount, data.price, data.comment, id])
result(null, results);
}
@ -33,7 +33,7 @@ export const updateOrderingInfoIssueSlipById = async (data, result) => {
// Delete ordering info issue slip to Database
export const deleteOrderingInfoIssueSlipById = async (id, result) => {
try {
let sql = `DELETE FROM orderingInfoIssueSlips WHERE primaryID = ?`;
let sql = `DELETE FROM orderinginfoissueslips WHERE primaryID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -47,7 +47,7 @@ export const deleteOrderingInfoIssueSlipById = async (id, result) => {
// Delete ordering info issue slip by issueSlipID to Database
export const deleteOrderingInfoIssueSlipByIssueSlipId = async (id, result) => {
try {
let sql = `DELETE FROM orderingInfoIssueSlips WHERE issueSlipID = ?`;
let sql = `DELETE FROM orderinginfoissueslips WHERE issueSlipID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -61,7 +61,7 @@ export const deleteOrderingInfoIssueSlipByIssueSlipId = async (id, result) => {
//insert ordering info issue slip to databased
export const insertOrderingInfoIssueSlip = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO orderingInfoIssueSlips(issueSlipID, article, amount, price, comment) VALUES(?, ?, ?, ?, ?)`, [data.issueSlipID, data.article, data.amount, data.price, data.comment])
const results = await ownConn.query(`INSERT INTO orderinginfoissueslips(issueSlipID, article, amount, price, comment) VALUES(?, ?, ?, ?, ?)`, [data.issueSlipID, data.article, data.amount, data.price, data.comment])
result(null, results);
}
catch (err) {

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//get all production orders
export const getProductionOrders = async (result) => {
try {
let sql = `SELECT * FROM productionOrders ORDER BY name ASC`;
let sql = `SELECT * FROM productionorders ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -17,7 +17,7 @@ export const getProductionOrders = async (result) => {
//get all selected production orders by ticketnumber
export const getSelectedProductionOrdersByTicketnumber = async (selected, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE ticketNumber LIKE '%${selected}%' ORDER BY ticketNumber ASC`;
let sql = `SELECT * FROM productionorders WHERE ticketNumber LIKE '%${selected}%' ORDER BY ticketNumber ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -31,7 +31,7 @@ export const getSelectedProductionOrdersByTicketnumber = async (selected, result
//get all selected production orders by customer
export const getSelectedProductionOrdersByCustomer = async (selected, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
let sql = `SELECT * FROM productionorders WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -45,7 +45,7 @@ export const getSelectedProductionOrdersByCustomer = async (selected, result) =>
//get all selected production orders by state
export const getSelectedProductionOrdersByState = async (selected, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE state LIKE '%${selected}%' ORDER BY state ASC`;
let sql = `SELECT * FROM productionorders WHERE state LIKE '%${selected}%' ORDER BY state ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -59,7 +59,7 @@ export const getSelectedProductionOrdersByState = async (selected, result) => {
//get all selected production orders by checklistname
export const getSelectedProductionOrdersByChecklistname = async (selected, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
let sql = `SELECT * FROM productionorders WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -73,7 +73,7 @@ export const getSelectedProductionOrdersByChecklistname = async (selected, resul
//get all selected production orders by date of creation
export const getSelectedProductionOrdersByDate = async (selected, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
let sql = `SELECT * FROM productionorders WHERE creationDate LIKE '%${selected}%' ORDER BY creationDate ASC`;
const results = await ownConn.execute(sql)
result(null, results);
}
@ -87,7 +87,7 @@ export const getSelectedProductionOrdersByDate = async (selected, result) => {
// Delete production order to Database
export const deleteProductionOrderById = async (id, result) => {
try {
let sql = `DELETE FROM productionOrders WHERE ticketNumber = ?`;
let sql = `DELETE FROM productionorders WHERE ticketNumber = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}
@ -101,7 +101,7 @@ export const deleteProductionOrderById = async (id, result) => {
//insert production order to database
export const insertProductionOrder = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO productionOrders(name, templateID, customer, customerID, asset, state, creationDate, completionDate, user, templateDescription, templateNotes, timeSpent, notes) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.name, data.templateID, data.customer, data.customerID, data.asset, data.state, data.creationDate, data.completionDate, data.user, data.templateDescription, data.templateNotes, data.timeSpent, data.notes])
const results = await ownConn.query(`INSERT INTO productionorders(name, templateID, customer, customerID, asset, state, creationDate, completionDate, user, templateDescription, templateNotes, timeSpent, notes) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [data.name, data.templateID, data.customer, data.customerID, data.asset, data.state, data.creationDate, data.completionDate, data.user, data.templateDescription, data.templateNotes, data.timeSpent, data.notes])
result(null, results);
}
catch (err) {
@ -114,7 +114,7 @@ export const insertProductionOrder = async (data, result) => {
//get single production order by name
export const getProductionOrderByName = async (id, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE name = ?`;
let sql = `SELECT * FROM productionorders WHERE name = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -128,7 +128,7 @@ export const getProductionOrderByName = async (id, result) => {
//get single production order by id
export const getProductionOrderById = async (id, result) => {
try {
let sql = `SELECT * FROM productionOrders WHERE ticketNumber = ?`;
let sql = `SELECT * FROM productionorders WHERE ticketNumber = ?`;
const results = await ownConn.execute(sql, [id])
result(null, results[0]);
}
@ -143,7 +143,7 @@ export const getProductionOrderById = async (id, result) => {
export const updateProductionOrderStateById = async (data, result) => {
const id = data.ticketNumber;
try {
let sql = `UPDATE productionOrders SET state = ? WHERE ticketNumber = ?`;
let sql = `UPDATE productionorders SET state = ? WHERE ticketNumber = ?`;
const results = await ownConn.query(sql, [data.state, id])
result(null, results);
}

View File

@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
//insert production order todo to databased
export const insertProductionOrderTodo = async (data, result) => {
try {
const results = await ownConn.query(`INSERT INTO productionOrderTodos(templateID, step, asset, task, comment, done) VALUES(?, ?, ?, ?, ?, ?)`, [data.templateID, data.step, data.asset, data.task, data.comment, data.done]);
const results = await ownConn.query(`INSERT INTO productionordertodos(templateID, step, asset, task, comment, done) VALUES(?, ?, ?, ?, ?, ?)`, [data.templateID, data.step, data.asset, data.task, data.comment, data.done]);
result(null, results);
}
catch (err) {
@ -16,7 +16,7 @@ export const insertProductionOrderTodo = async (data, result) => {
//get single production order todo by id
export const getProductionOrderTodosById = async (id, result) => {
try {
let sql = `SELECT * FROM productionOrderTodos WHERE templateID = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM productionordertodos WHERE templateID = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -30,7 +30,7 @@ export const getProductionOrderTodosById = async (id, result) => {
//get single production order todo by asset
export const getProductionOrderTodosByAsset = async (id, result) => {
try {
let sql = `SELECT * FROM productionOrderTodos WHERE asset = ? ORDER BY primaryID ASC`;
let sql = `SELECT * FROM productionordertodos WHERE asset = ? ORDER BY primaryID ASC`;
const results = await ownConn.execute(sql, [id])
result(null, results);
}
@ -45,7 +45,7 @@ export const getProductionOrderTodosByAsset = async (id, result) => {
export const updateProductionOrderTodoById = async (data, result) => {
try {
const id = data.primaryID;
let sql = `UPDATE productionOrderTodos SET step = ?, asset = ?, task = ?, comment = ?, done = ? WHERE primaryID = ?`;
let sql = `UPDATE productionordertodos SET step = ?, asset = ?, task = ?, comment = ?, done = ? WHERE primaryID = ?`;
const results = await ownConn.query(sql, [data.step, data.asset, data.task, data.comment, data.done, id])
result(null, results);
}
@ -59,7 +59,7 @@ export const updateProductionOrderTodoById = async (data, result) => {
// Delete production order todos to Database
export const deleteProductionOrderTodosChecklistID = async (id, result) => {
try {
let sql = `DELETE FROM productionOrderTodos WHERE templateID = ?`;
let sql = `DELETE FROM productionordertodos WHERE templateID = ?`;
const results = await ownConn.query(sql, [id])
result(null, results);
}