first commit

This commit is contained in:
Daniel
2023-02-02 00:43:27 +02:00
commit 679d857570
29 changed files with 3540 additions and 0 deletions

14
controllers/deleteTask.js Normal file
View File

@@ -0,0 +1,14 @@
const { findById } = require("../models/taskModel")
const taskModel = require("../models/taskModel")
const deleteTask = async (req, res, next) => {
try {
const task = await taskModel.findByIdAndDelete(req.params.id)
if (!task) return res.status(404).json({msg: `Null task with id ${req.params.id}`})
res.status(200).json({msg: "Success deletion"})
} catch (error) {
res.status(400).json({msg: error})
}
}
module.exports = deleteTask