diff --git a/src/controllers/search.controller.js b/src/controllers/search.controller.js index 4df3c05..dc00e07 100644 --- a/src/controllers/search.controller.js +++ b/src/controllers/search.controller.js @@ -6,7 +6,9 @@ import jwt from "jsonwebtoken"; export const vidoeSearchKeyWord= async (req,res)=>{ try { - if(req.query.keywordName=" "){ + + const keyword=req.query.keywordName; + if(keyword===" "){ res.send(response(status.SUCCESS,await viewSearchKeyword({ "videos":[] }))); @@ -33,7 +35,7 @@ export const vidoeSearchTag = async (req, res)=>{ const token = req.headers.authorization.split(' ')[1]; const decoded = jwt.verify(token, process.env.JWT_SECRET); req.userId = decoded.id; - if(req.query.hashtagName=" "){ + if(req.query.hashtagName===" "){ res.send(response(status.SUCCESS,await viewSearchKeyword({ "videos":[] }))); diff --git a/src/dtos/search.dto.js b/src/dtos/search.dto.js index be2e2af..6e8f864 100644 --- a/src/dtos/search.dto.js +++ b/src/dtos/search.dto.js @@ -13,7 +13,7 @@ export const getSearchKeywordResponseDTO = async (video) => { for (let j = 0; j < video.length; j++) { for (let i = 0; i < video[j].length; i++) { - console.log("초기단계", videoData[i - 1]?.id); + // 이미 추가된 id인지 체크 if (!addedIds.includes(video[j][i].id)) { @@ -33,7 +33,7 @@ export const getSearchKeywordResponseDTO = async (video) => { } } for(let i =0; i