From 6543e9a6c9d33236001042984f9a2950307ec587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Sun, 24 May 2026 16:16:29 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20Article=20ReadModel=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/article/model/readmodel/ArticleSummary.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java diff --git a/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java b/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java new file mode 100644 index 000000000..40f6b58e1 --- /dev/null +++ b/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java @@ -0,0 +1,8 @@ +package in.koreatech.koin.domain.community.article.model.readmodel; + +public record ArticleSummary( + Integer id, + String title +) { + +} From 8cbbf14bfb2b30d01255b26c8d738c362739e8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Sun, 24 May 2026 16:18:57 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20ArticleSummary=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=8C=EC=A7=80=ED=86=A0=EB=A6=AC=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../article/repository/ArticleRepository.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java b/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java index 924c814e6..3f72fb36c 100644 --- a/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java +++ b/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java @@ -20,6 +20,7 @@ import in.koreatech.koin.domain.community.article.exception.BoardNotFoundException; import in.koreatech.koin.domain.community.article.model.Article; import in.koreatech.koin.domain.community.article.model.Board; +import in.koreatech.koin.domain.community.article.model.readmodel.ArticleSummary; import jakarta.persistence.EntityNotFoundException; public interface ArticleRepository extends Repository { @@ -32,6 +33,16 @@ public interface ArticleRepository extends Repository { List
findAllByIdIn(Collection articleIds); + @Query(""" + SELECT new in.koreatech.koin.domain.community.article.model.readmodel.ArticleSummary( + a.id, + a.title + ) + FROM Article a + WHERE a.id IN :articleIds + """) + List findAllSummariesByIdIn(@Param("articleIds") Collection articleIds); + Page
findAll(Pageable pageable); Page
findAllByBoardIdNot(Integer boardId, PageRequest pageRequest); From 4ed909044086308a470c479adaaad5e83810d026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Sun, 24 May 2026 16:21:54 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20ArticleSummary=20boardId=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Conflicts: # src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java --- .../article/model/readmodel/ArticleSummary.java | 1 + .../community/keyword/service/KeywordService.java | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java b/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java index 40f6b58e1..d3473b4c6 100644 --- a/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java +++ b/src/main/java/in/koreatech/koin/domain/community/article/model/readmodel/ArticleSummary.java @@ -2,6 +2,7 @@ public record ArticleSummary( Integer id, + Integer boardId, String title ) { diff --git a/src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java b/src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java index 9e3a11d89..3a477d6f4 100644 --- a/src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java +++ b/src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java @@ -15,7 +15,7 @@ import in.koreatech.koin.common.event.KoreatechArticleKeywordEvent; import in.koreatech.koin.domain.community.article.dto.ArticleKeywordResult; -import in.koreatech.koin.domain.community.article.model.Article; +import in.koreatech.koin.domain.community.article.model.readmodel.ArticleSummary; import in.koreatech.koin.domain.community.article.repository.ArticleRepository; import in.koreatech.koin.domain.community.keyword.dto.ArticleKeywordCreateRequest; import in.koreatech.koin.domain.community.keyword.dto.ArticleKeywordResponse; @@ -153,10 +153,10 @@ public ArticleKeywordsSuggestionResponse suggestKeywords(KeywordCategory categor public void sendKeywordNotification(KeywordNotificationRequest request) { Set updateNotificationIds = request.updateNotification(); - List
articles = articleRepository.findAllByIdIn(updateNotificationIds); + List articleSummaries = articleRepository.findAllSummariesByIdIn(updateNotificationIds); - for (Article article : articles) { - List matchedKeywords = keywordExtractor.matchKeywords(article.getTitle(), KeywordCategory.KOREATECH); + for (ArticleSummary articleSummary : articleSummaries) { + List matchedKeywords = keywordExtractor.matchKeywords(articleSummary.title(), KeywordCategory.KOREATECH); if (matchedKeywords.isEmpty()) { continue; } @@ -170,9 +170,9 @@ public void sendKeywordNotification(KeywordNotificationRequest request) { } eventPublisher.publishEvent(KoreatechArticleKeywordEvent.of( - article.getId(), - article.getBoard().getId(), - article.getTitle(), + articleSummary.id(), + articleSummary.boardId(), + articleSummary.title(), keywordByUserId )); } From 228074aff457012b413ab436e93da9a71b3d2932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Sun, 24 May 2026 16:22:21 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=EB=A6=AC=ED=8C=8C=EC=A7=80=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/community/article/repository/ArticleRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java b/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java index 3f72fb36c..109c95a97 100644 --- a/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java +++ b/src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java @@ -36,6 +36,7 @@ public interface ArticleRepository extends Repository { @Query(""" SELECT new in.koreatech.koin.domain.community.article.model.readmodel.ArticleSummary( a.id, + a.board.id, a.title ) FROM Article a