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:12:17 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dbf65149c1a64a29820f993e74fd1b924db47012
dbf65149
1 parent
0f29049d
feat: category 삭제 기능
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 @
dbf6514
...
...
@@ -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