//check existing movie
if (req.body.movieName && req.body.year) {
let existMovie = await Movie.find({
where: {
id: { '!=': movieId },
movieName: req.body.movieName,
year: req.body.year
},
});
console.log('exit movie', existMovie)
if (existMovie.length > 0) {
return res.status(400).json({
success: false,
message: `This movie is already exist`
});
}
}
0 Comments