added backend implementation
This commit is contained in:
66
backend/controller/productionOrderTodos.js
Normal file
66
backend/controller/productionOrderTodos.js
Normal 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);
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user