Update: Playlist.create same name and playlist deletd
This commit is contained in:
parent
4af6891bd5
commit
cbb72a8382
1 changed files with 3 additions and 3 deletions
|
|
@ -41,7 +41,7 @@ exports.create = (req, res) => {
|
||||||
.save(video)
|
.save(video)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if(data) {
|
if(data) {
|
||||||
Playlist.exists({name: req.body.name}, function (err, docs){
|
Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){
|
||||||
if(err){
|
if(err){
|
||||||
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
||||||
} else{
|
} else{
|
||||||
|
|
@ -76,7 +76,7 @@ exports.create = (req, res) => {
|
||||||
});
|
});
|
||||||
} else{
|
} else{
|
||||||
const id = docs._id.toString();
|
const id = docs._id.toString();
|
||||||
Playlist.exists({name: req.body.name}, function (err, docs){
|
Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){
|
||||||
if(err){
|
if(err){
|
||||||
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
||||||
} else{
|
} else{
|
||||||
|
|
@ -108,7 +108,7 @@ exports.create = (req, res) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Playlist.exists({name: req.body.name}, function (err, docs){
|
Playlist.exists({name: req.body.name, isActive: true}, function (err, docs){
|
||||||
if(err){
|
if(err){
|
||||||
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
sendError(res, 500,100,err.message || "Some error occurred while checking if the Playlist already exists.", token);
|
||||||
} else{
|
} else{
|
||||||
|
|
|
||||||
Reference in a new issue