From e1ab3ee6d1a4fc279df70b380c24ada112cffe97 Mon Sep 17 00:00:00 2001 From: donglee99 Date: Mon, 20 Nov 2023 13:49:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?hotfix:=20=EC=B5=9C=EA=B7=BC=20=EB=B6=81?= =?UTF-8?q?=EB=A7=88=ED=81=AC=20=EB=90=9C=20=EC=B9=B4=EB=93=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/cardService.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/cardService.ts b/src/services/cardService.ts index e1d2cb5..646b7e7 100644 --- a/src/services/cardService.ts +++ b/src/services/cardService.ts @@ -123,16 +123,18 @@ const findRecentlyUpdatedCard = async (userId?: Types.ObjectId) => { const findRecentlyBookmarkedCard = async (userId?: Types.ObjectId) => { const bookmarks: BookmarkDocument[] = await Bookmark.aggregate() - .group({ - _id: '$card', - card: { $first: '$card' }, - createdAt: { $first: '$createdAt' } - }) .sort({ createdAt: -1 }) .limit(20); + console.log(bookmarks.length); + for (const bookmark of bookmarks) { + console.log(bookmark.createdAt); + } const cards: CardDocument[] = ( await Promise.all(bookmarks.map(bookmark => Card.findById(bookmark.card))) ).filter(util.isNotEmpty); + for (const card of cards) { + console.log(card.content); + } const totalCards: CardResponseDto[] = []; for (const card of cards) { totalCards.push(await createCardResponse(card, userId)); From 8a303ea30c7467fee32ce36bdbbe11ade3d9ebca Mon Sep 17 00:00:00 2001 From: donglee99 Date: Mon, 20 Nov 2023 14:02:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?hotfix:=20=EC=B5=9C=EA=B7=BC=20=EB=B6=81?= =?UTF-8?q?=EB=A7=88=ED=81=AC=20=EB=90=9C=20=EC=B9=B4=EB=93=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/cardService.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/services/cardService.ts b/src/services/cardService.ts index 646b7e7..abf092a 100644 --- a/src/services/cardService.ts +++ b/src/services/cardService.ts @@ -125,16 +125,9 @@ const findRecentlyBookmarkedCard = async (userId?: Types.ObjectId) => { const bookmarks: BookmarkDocument[] = await Bookmark.aggregate() .sort({ createdAt: -1 }) .limit(20); - console.log(bookmarks.length); - for (const bookmark of bookmarks) { - console.log(bookmark.createdAt); - } const cards: CardDocument[] = ( await Promise.all(bookmarks.map(bookmark => Card.findById(bookmark.card))) ).filter(util.isNotEmpty); - for (const card of cards) { - console.log(card.content); - } const totalCards: CardResponseDto[] = []; for (const card of cards) { totalCards.push(await createCardResponse(card, userId));