From 0bd64cb8f56306d87e7b735a770be37be1911097 Mon Sep 17 00:00:00 2001 From: jainefer Date: Tue, 20 Feb 2024 20:03:59 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=ED=83=9C=EA=B7=B8=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/search.controller.js | 6 ++++-- src/dtos/search.dto.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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