From 2fa619fd838720fd62379f10e255fd7980d8d37d Mon Sep 17 00:00:00 2001 From: Nghia <19204686+nghiamphan@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:25:49 -0300 Subject: [PATCH] backend: fix sequelize syntax error --- backend/controllers/movies.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/controllers/movies.js b/backend/controllers/movies.js index 6ffefec..60cbabd 100644 --- a/backend/controllers/movies.js +++ b/backend/controllers/movies.js @@ -222,7 +222,7 @@ router.post('/advanced-search', async (req, res) => { whereCondition.imdbVotes = { ...whereCondition.imdbVotes, [Op.and]: [ - ...(whereCondition.imdbVotes[Op.and] || [{ [Op.ne]: 'N/A' }]), + ...(whereCondition.imdbVotes || [{ [Op.ne]: 'N/A' }]), literal(`CAST(REPLACE(imdb_votes, ',', '') AS INTEGER) <= ${imdbVotesMax}`), ], } @@ -240,7 +240,7 @@ router.post('/advanced-search', async (req, res) => { whereCondition.imdbRating = { ...whereCondition.imdbRating, [Op.and]: [ - ...(whereCondition.imdbRating[Op.and] || [{ [Op.ne]: 'N/A' }]), + ...(whereCondition.imdbRating || [{ [Op.ne]: 'N/A' }]), literal(`CAST(imdb_rating AS FLOAT) <= ${imdbRatingMax}`), ], }