added backend implementation

This commit is contained in:
2024-02-02 10:53:48 +01:00
parent c18ec3084e
commit 6094ab6df3
43 changed files with 4360 additions and 61 deletions

View File

@ -0,0 +1,66 @@
//import functions from production order todo model
import {
insertProductionOrderTodo,
getProductionOrderTodosById,
getProductionOrderTodosByAsset,
updateProductionOrderTodoById,
deleteProductionOrderTodosChecklistID,
} from "../models/productionOrdersTodosModel.js";
//create new production order todo
export const createProductionOrderTodos = (req, res) => {
const data = req.body;
insertProductionOrderTodo(data, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
//get single production order todos by id
export const showProductionOrderTodosById = (req, res) => {
getProductionOrderTodosById(req.params.id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
//get single production order todos by asset
export const showProductionOrderTodosByAsset = (req, res) => {
getProductionOrderTodosByAsset(req.params.id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
// Update production order todo
export const updateProductionOrderTodo = (req, res) => {
const data = req.body;
updateProductionOrderTodoById(data, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
// Delete production order todos
export const deleteProductionOrderTodos = (req, res) => {
const id = req.params.id;
deleteProductionOrderTodosChecklistID(id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};