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