Update: Video.delete

This commit is contained in:
Yûki VACHOT 2021-12-11 10:44:32 +01:00
parent 83f49038ea
commit 5fffe19d98

View file

@ -316,7 +316,7 @@ exports.delete = (req, res) => {
if(id && ObjectId.isValid(id)){
Video.updateOne({_id: id, userId: token.id, isActive: true}, {isActive: false}, {useFindAndModify: false})
.then(data => {
if(data) {
if(data.modifiedCount > 0) {
return sendMessage(res, 37, {message: `Video ${id} was successfully deleted.`}, token);
} else {
return sendError(res, 404, 105, `Video not found with id=${id}`, token);