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,79 @@
//import functions from checklist solutions model
import {
insertChecklistSolutionTodo,
getChecklistSolutionTodosById,
getChecklistSolutionTodosByAsset,
updateChecklistSolutionTodoById,
deleteAllChecklistSolutionTodosSolutionID,
deleteChecklistSolutionTodo,
} from "../models/checklistSolutionsModel.js";
//create new checklist solution todo
export const createChecklistSolutionTodos = (req, res) => {
const data = req.body;
insertChecklistSolutionTodo(data, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
//get single checklist solution todos by id
export const showChecklistSolutionTodosById = (req, res) => {
getChecklistSolutionTodosById(req.params.id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
//get single checklist solution todos by asset
export const showChecklistSolutionTodosByAsset = (req, res) => {
getChecklistSolutionTodosByAsset(req.params.id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
// Update checklist solution todo
export const updateChecklistSolutionTodo = (req, res) => {
const data = req.body;
updateChecklistSolutionTodoById(data, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
// Delete checklist solution todos by solution ID
export const deleteChecklistSolutionTodosSolutionID = (req, res) => {
const id = req.params.id;
deleteAllChecklistSolutionTodosSolutionID(id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};
// Delete checklist solution todos by primaryID
export const deleteChecklistSolutionTodos = (req, res) => {
const id = req.params.id;
deleteChecklistSolutionTodo(id, (err, results) => {
if (err) {
res.send(err);
} else {
res.json(results);
}
});
};