이승윤

feat: category 삭제 기능

......@@ -177,9 +177,20 @@ router.post('/products/edit/:id', loginRequired, function (req, res) {
});
router.get('/products/delete/:id', function (req, res) {
CategoriModel.findOne({ _id: req.params.id }, function (err, products) {
CategoriModel.deleteMany({ _id: req.params.id }, function (err) {
VideoModel.find(function (err, myVideo) {
for (var i in myVideo) {
if (products.title == myVideo[i].categori) {
var deleteItem = myVideo[i].categori;
}
}
VideoModel.deleteMany({ categori: deleteItem }, function (err) {
res.redirect('/categori/products');
});
});
});
});
});
router.post('/products/ajax_comment/insert', function (req, res) {
......