Skip to content

Commit

Permalink
[fix] 검색 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jainefer committed Feb 18, 2024
1 parent 1e24026 commit 8efd04a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/dtos/search.dto.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export const getSearchKeywordResponseDTO = async (video) => {

export const getSearchTagResponseDTO = async(video) => {
try {
console.log(video);
//console.log(video);
const videoData = [];
const addedIds = []; // 이미 추가된 id를 기억하는 배열
const tagData=[];
console.log("비디오 데이터 처음", videoData);
//console.log("비디오 데이터 처음", videoData);

for (let j = 0; j < video.length; j++) {
for (let i = 0; i < video[j].length; i++) {
console.log("초기단계", videoData[i - 1]?.id);
//console.log("초기단계", videoData[i - 1]?.id);

// 이미 추가된 id인지 체크
if (!addedIds.includes(video[j][i].id)) {
Expand All @@ -77,7 +77,7 @@ export const getSearchTagResponseDTO = async(video) => {
}

for(let i =0; i<videoData.length;i++){
console.log(i+"번째 영상 ",videoData[i].id);
//console.log(i+"번째 영상 ",videoData[i].id);
tagData.push(await getTag({
"videoID":videoData[i].id,
"version":"revision"
Expand All @@ -92,8 +92,8 @@ export const getSearchTagResponseDTO = async(video) => {
export const getCombinedResultDTO=(video,tag)=>{
const videoData=[]

console.log("태그 데이터",tag);
console.log("비디오는",video);
//console.log("태그 데이터",tag);
//console.log("비디오는",video);
for(let i=0;i<tag.length;i++){
const tagData=[]
for(let j=0;j<tag[i].length;j++){
Expand Down
4 changes: 2 additions & 2 deletions src/models/search.dao.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getVideoKeyword =async(req)=>{
console.log(req);
const conn = await pool.getConnection();
const [video]=await pool.query(getVideoKeywordSql,[req.userId,'%'+req.keyword+'%','%'+req.keyword+'%','%'+req.keyword+'%']);
console.log("비디오 데이터 원본 ",video);
//console.log("비디오 데이터 원본 ",video);
conn.release();
return video;
} catch (error) {
Expand All @@ -25,7 +25,7 @@ export const getVideoTag = async(req)=>{
console.log(req);
const conn = await pool.getConnection();
const [video]=await pool.query(getVideoTagSql,[req.userId,'%'+req.tag+'%']);
console.log("비디오 데이터",video);
//console.log("비디오 데이터",video);
conn.release();
return video;
}catch(error){
Expand Down
4 changes: 2 additions & 2 deletions src/models/search.sql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/services/search.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export const viewSearchKeyword=async(data)=>{
}

export const viewSearchTag=async(data)=>{
console.log("서비스에서 전달되는 요청 정보",data);
//console.log("서비스에서 전달되는 요청 정보",data);
const getVideoData=[];
for(let i=0;i<data.hashtag.length;i++){
getVideoData.push(await getVideoTag({
"userId":data.userId,
"tag":data.hashtag[i]
}));
}
console.log("비디오 정보",getVideoData);

getVideoData.push(await getVideoTag({
"userId":data.userId,
"tag":data.hashtag
}));

//console.log("비디오 정보",getVideoData);
return getSearchTagResponseDTO(getVideoData);
}

0 comments on commit 8efd04a

Please sign in to comment.