From 8e9be620d88eb0048120a3d158fce98f8890933d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Mon, 30 Mar 2026 17:30:50 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20ArticleSummary=20=EB=A0=88=EC=BD=94?= =?UTF-8?q?=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 --- .../koin/domain/community/article/dto/ArticleSummary.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java diff --git a/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java b/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java new file mode 100644 index 000000000..a88023fdd --- /dev/null +++ b/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java @@ -0,0 +1,8 @@ +package in.koreatech.koin.domain.community.article.dto; + +public record ArticleSummary( + Integer id, + String title +) { + +} \ No newline at end of file From 2e945eb2093e5e8e61b9f08760132741dfcb07e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Mon, 30 Mar 2026 17:31:02 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20findAllSummaryByIdIn=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=8C=EC=A7=80=ED=86=A0=EB=A6=AC=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=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 --- .../community/article/repository/ArticleRepository.java | 8 ++++++++ 1 file changed, 8 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 f0e6f4055..0a8b3e1c7 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 @@ -15,6 +15,7 @@ import org.springframework.data.repository.Repository; import org.springframework.data.repository.query.Param; +import in.koreatech.koin.domain.community.article.dto.ArticleSummary; import in.koreatech.koin.domain.community.article.exception.ArticleNotFoundException; import in.koreatech.koin.domain.community.article.exception.BoardNotFoundException; import in.koreatech.koin.domain.community.article.model.Article; @@ -31,6 +32,13 @@ public interface ArticleRepository extends Repository { List
findAllByIdIn(Collection articleIds); + @Query(value = """ + SELECT new in.koreatech.koin.domain.community.article.dto.ArticleSummary(a.id, a.title) + FROM Article a + WHERE a.id IN :articleIds + """) + List findAllSummaryByIdIn(@Param("articleIds") Collection articleIds); + Page
findAll(Pageable pageable); Page
findAllByBoardIdNot(Integer boardId, PageRequest pageRequest); From d4714576c4ee88cc941a4d910d37ff71be30d38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Mon, 30 Mar 2026 17:34:06 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20ArticleSummary=20=EC=A0=95=EC=A0=81?= =?UTF-8?q?=20=ED=8C=A9=ED=86=A0=EB=A6=AC=20=EB=A9=94=EC=86=8C=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../koin/domain/community/article/dto/ArticleSummary.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java b/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java index a88023fdd..0de39a2e1 100644 --- a/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java +++ b/src/main/java/in/koreatech/koin/domain/community/article/dto/ArticleSummary.java @@ -4,5 +4,7 @@ public record ArticleSummary( Integer id, String title ) { - -} \ No newline at end of file + public static ArticleSummary of(Integer id, String title) { + return new ArticleSummary(id, title); + } +} From 7a560a40bbf8b98d921fe865ed61d0bcedb44160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Mon, 30 Mar 2026 17:37:22 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20findAllSummaryByIdIn=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=EB=A5=BC=20=ED=99=9C=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../keyword/service/KeywordService.java | 5 +++-- .../community/util/KeywordExtractor.java | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) 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 544312574..91975a7eb 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 @@ -13,6 +13,7 @@ import in.koreatech.koin.common.event.ArticleKeywordEvent; import in.koreatech.koin.domain.community.article.dto.ArticleKeywordResult; +import in.koreatech.koin.domain.community.article.dto.ArticleSummary; import in.koreatech.koin.domain.community.article.model.Article; import in.koreatech.koin.domain.community.article.repository.ArticleRepository; import in.koreatech.koin.domain.community.keyword.dto.ArticleKeywordCreateRequest; @@ -150,8 +151,8 @@ public void sendKeywordNotification(KeywordNotificationRequest request) { return; } - List
articles = articleRepository.findAllByIdIn(request.updateNotification()); - List keywordEvents = keywordExtractor.matchKeyword(articles, null); + List articleSummaries = articleRepository.findAllSummaryByIdIn(request.updateNotification()); + List keywordEvents = keywordExtractor.matchKeyword(articleSummaries, null); for (ArticleKeywordEvent event : keywordEvents) { eventPublisher.publishEvent(event); } diff --git a/src/main/java/in/koreatech/koin/domain/community/util/KeywordExtractor.java b/src/main/java/in/koreatech/koin/domain/community/util/KeywordExtractor.java index 87a7516b2..1804eaf6a 100644 --- a/src/main/java/in/koreatech/koin/domain/community/util/KeywordExtractor.java +++ b/src/main/java/in/koreatech/koin/domain/community/util/KeywordExtractor.java @@ -7,7 +7,7 @@ import org.springframework.stereotype.Component; -import in.koreatech.koin.domain.community.article.model.Article; +import in.koreatech.koin.domain.community.article.dto.ArticleSummary; import in.koreatech.koin.domain.community.keyword.model.ArticleKeywordUserMap; import in.koreatech.koin.domain.community.keyword.model.KeywordMatchResult; @@ -15,14 +15,14 @@ public class KeywordExtractor { public List matchKeyword( - List
articles, List articleKeywordUserMaps, Integer authorId + List articleSummaries, List articleKeywordUserMaps, Integer authorId ) { Set keywordMatchResults = new HashSet<>(); - for (Article article : articles) { + for (ArticleSummary articleSummary : articleSummaries) { for (ArticleKeywordUserMap articleKeywordUserMap : articleKeywordUserMaps) { - if (isMatchable(article, articleKeywordUserMap, authorId)) { - addOrUpdateResult(keywordMatchResults, article, articleKeywordUserMap); + if (isMatchable(articleSummary, articleKeywordUserMap, authorId)) { + addOrUpdateResult(keywordMatchResults, articleSummary, articleKeywordUserMap); } } } @@ -30,16 +30,19 @@ public List matchKeyword( return keywordMatchResults.stream().toList(); } - private boolean isMatchable(Article article, ArticleKeywordUserMap articleKeywordUserMap, Integer authorId) { + private boolean isMatchable( + ArticleSummary articleSummaries, ArticleKeywordUserMap articleKeywordUserMap, Integer authorId + ) { return !Objects.equals(articleKeywordUserMap.getUserId(), authorId) - && article.getTitle().contains(articleKeywordUserMap.getKeyword()); + && articleSummaries.title().contains(articleKeywordUserMap.getKeyword()); } private void addOrUpdateResult( - Set keywordMatchResults, Article article, ArticleKeywordUserMap articleKeywordUserMap + Set keywordMatchResults, ArticleSummary ArticleSummary, + ArticleKeywordUserMap articleKeywordUserMap ) { KeywordMatchResult keywordMatchResult = KeywordMatchResult.of( - article.getId(), articleKeywordUserMap.getUserId(), articleKeywordUserMap.getKeyword() + ArticleSummary.id(), articleKeywordUserMap.getUserId(), articleKeywordUserMap.getKeyword() ); keywordMatchResults.stream()