From 92db177295b8ac736b6aa03bcc18fcca0ad9ea83 Mon Sep 17 00:00:00 2001 From: Hyun-git Date: Sat, 5 Oct 2024 00:02:12 +0900 Subject: [PATCH] =?UTF-8?q?FIX:=20MEME=20=EC=9D=B8=ED=84=B0=EB=A0=89?= =?UTF-8?q?=EC=85=98=20=EC=83=9D=EC=84=B1=EB=90=A0=EB=95=8C=EB=8F=84=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=ED=95=98=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/meme.ts | 2 +- src/service/meme.service.ts | 16 ++++++++-------- src/service/memeInteraction.service.ts | 1 - 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/routes/meme.ts b/src/routes/meme.ts index f3eedda..e64b372 100644 --- a/src/routes/meme.ts +++ b/src/routes/meme.ts @@ -299,7 +299,7 @@ router.get('/list', getRequestedUserInfo, getAllMemeList); // meme 목록 전체 * type: null * example: null */ -router.get('/recommend-memes', getRequestedUserInfo, getLatestMemeList); // 오늘의 추천 밈 (5개) +router.get('/recommend-memes', getRequestedUserInfo, getLatestMemeList); // 오늘의 추천 밈 (20개) /** * @swagger diff --git a/src/service/meme.service.ts b/src/service/meme.service.ts index 2336a47..fab526c 100644 --- a/src/service/meme.service.ts +++ b/src/service/meme.service.ts @@ -67,7 +67,7 @@ async function getLatestCreatedMeme( try { const latestMemeList = await MemeModel.find({ isDeleted: false }, { isDeleted: 0 }) .limit(limit) - .sort({_id: -1}) + .sort({ _id: -1 }) .lean(); const memeList = await getMemeListWithKeywordsAndisSavedAndisReaction(user, latestMemeList); @@ -311,14 +311,14 @@ async function createMemeInteraction( if (_.isNull(memeInteraction)) { // 신규 생성 await MemeInteractionService.createMemeInteraction(user, meme, interactionType); - } else { - logger.info( - `Already ${interactionType} meme - deviceId(${user.deviceId}), memeId(${meme._id})`, - ); - - // interactionType에 따른 동작 처리 (MemeInteracionService에서 진행) - await MemeInteractionService.updateMemeInteraction(user, meme, interactionType, count); } + logger.info( + `Already ${interactionType} meme - deviceId(${user.deviceId}), memeId(${meme._id})`, + ); + + // interactionType에 따른 동작 처리 (MemeInteracionService에서 진행) + await MemeInteractionService.updateMemeInteraction(user, meme, interactionType, count); + return true; } catch (err) { throw new CustomError( diff --git a/src/service/memeInteraction.service.ts b/src/service/memeInteraction.service.ts index eb61d2e..e736a95 100644 --- a/src/service/memeInteraction.service.ts +++ b/src/service/memeInteraction.service.ts @@ -149,7 +149,6 @@ async function updateMemeInteraction( break; // 'reaction' Meme.reaction count 올리기 - // User의 'reaction' count는 밈당 1번 case InteractionType.REACTION: await MemeModel.findOneAndUpdate( { _id: meme._id, isDeleted: false },