Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이승윤
/
OpenSource-MyCookBook
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이승윤
2021-05-30 22:40:33 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
491013950d9c58eaea163bbf28f90bce7de7514c
49101395
2 parents
2faf482b
dbf65149
Merge branch 'feat/Video' into 'develop'
feat: category 삭제 기능 See merge request
!8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
routes/categori.js
routes/categori.js
View file @
4910139
...
...
@@ -177,8 +177,19 @@ router.post('/products/edit/:id', loginRequired, function (req, res) {
});
router
.
get
(
'/products/delete/:id'
,
function
(
req
,
res
)
{
CategoriModel
.
deleteMany
({
_id
:
req
.
params
.
id
},
function
(
err
)
{
res
.
redirect
(
'/categori/products'
);
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'
);
});
});
});
});
});
...
...
Please
register
or
login
to post a comment