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