이승윤

Merge branch 'feat/Video' into 'develop'

feat: category 삭제 기능



See merge request !8
...@@ -177,9 +177,20 @@ router.post('/products/edit/:id', loginRequired, function (req, res) { ...@@ -177,9 +177,20 @@ router.post('/products/edit/:id', loginRequired, function (req, res) {
177 }); 177 });
178 178
179 router.get('/products/delete/:id', function (req, res) { 179 router.get('/products/delete/:id', function (req, res) {
180 + CategoriModel.findOne({ _id: req.params.id }, function (err, products) {
180 CategoriModel.deleteMany({ _id: req.params.id }, function (err) { 181 CategoriModel.deleteMany({ _id: req.params.id }, function (err) {
182 + VideoModel.find(function (err, myVideo) {
183 + for (var i in myVideo) {
184 + if (products.title == myVideo[i].categori) {
185 + var deleteItem = myVideo[i].categori;
186 + }
187 + }
188 + VideoModel.deleteMany({ categori: deleteItem }, function (err) {
181 res.redirect('/categori/products'); 189 res.redirect('/categori/products');
182 }); 190 });
191 + });
192 + });
193 + });
183 }); 194 });
184 195
185 router.post('/products/ajax_comment/insert', function (req, res) { 196 router.post('/products/ajax_comment/insert', function (req, res) {
......