From e0c608ad9b8aded2590bdd51435ccfd70898eb0a Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Wed, 15 Jan 2025 18:35:32 +0900 Subject: [PATCH] =?UTF-8?q?test:=20connection=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../article/usecase/BrowseArticlesUseCase.kt | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt b/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt index 9f669798..1c03c8ba 100644 --- a/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt +++ b/api/src/main/kotlin/com/few/api/domain/article/usecase/BrowseArticlesUseCase.kt @@ -39,20 +39,11 @@ class BrowseArticlesUseCase( } val articleIds = articleViewsRecords.map { it.articleId }.toList() - /** - * ARTICLE_MAIN_CARD 테이블에서 이번 스크롤에서 보여줄 10개 아티클 조회 - */ - val articleMainCardRecords: List = - articleIds.mapNotNull { - articleMainCardDao.selectArticleMainCardsRecord( - it, - ) - } + val articleMainCardRecords: Set = + articleMainCardDao.selectArticleMainCardsRecord(articleIds.toSortedSet()) - /** - * 아티클 컨텐츠는 ARTICLE_MAIN_CARD가 아닌 ARTICLE_IFO에서 조회 (TODO: 캐싱 적용) - */ - val selectArticleContentsRecords: List = articleIds.mapNotNull { articleDao.selectArticleContent(it) } + val selectArticleContentsRecords: List = + articleDao.selectArticleContents(articleIds.toSortedSet()) articleMainCardRecords.withIndex().forEach { (index, articleMainCardRecord) -> articleMainCardRecord.content = selectArticleContentsRecords[index].content