Skip to content

Commit fef1319

Browse files
committed
feat: updateNotification 자료형 Set으로 수정
1 parent b3ffca8 commit fef1319

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/main/java/in/koreatech/koin/domain/community/article/repository/ArticleRepository.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static in.koreatech.koin.domain.community.article.service.ArticleService.NOTICE_BOARD_ID;
55

66
import java.time.LocalDate;
7+
import java.util.Collection;
78
import java.util.List;
89
import java.util.Optional;
910

@@ -28,7 +29,7 @@ public interface ArticleRepository extends Repository<Article, Integer> {
2829

2930
Optional<Article> findById(Integer articleId);
3031

31-
List<Article> findAllByIdIn(List<Integer> articleIds);
32+
List<Article> findAllByIdIn(Collection<Integer> articleIds);
3233

3334
Page<Article> findAll(Pageable pageable);
3435

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package in.koreatech.koin.domain.community.keyword.dto;
22

3-
import java.util.List;
3+
import java.util.Set;
44

55
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
66
import com.fasterxml.jackson.databind.annotation.JsonNaming;
@@ -9,10 +9,10 @@
99
import jakarta.validation.constraints.NotNull;
1010

1111
@JsonNaming(SnakeCaseStrategy.class)
12-
public record KeywordNotificationRequest (
12+
public record KeywordNotificationRequest(
1313
@Schema(description = "업데이트 된 공지사항 목록", example = "[1, 2, 3]")
1414
@NotNull
15-
List<Integer> updateNotification
15+
Set<Integer> updateNotification
1616
) {
1717

1818
}

src/main/java/in/koreatech/koin/domain/community/keyword/service/KeywordService.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,14 @@ public ArticleKeywordsSuggestionResponse suggestKeywords() {
147147
}
148148

149149
public void sendKeywordNotification(KeywordNotificationRequest request) {
150-
List<Integer> updateNotificationIds = request.updateNotification().stream()
151-
.distinct()
152-
.toList();
153-
154-
if (updateNotificationIds.isEmpty()) {
150+
if (request.updateNotification().isEmpty()) {
155151
return;
156152
}
157153

158-
List<Article> fetchedArticles = articleRepository.findAllByIdIn(updateNotificationIds);
154+
List<Article> fetchedArticles = articleRepository.findAllByIdIn(request.updateNotification());
159155
var articleById = fetchedArticles.stream()
160156
.collect(Collectors.toMap(Article::getId, article -> article));
161-
List<Article> articles = updateNotificationIds.stream()
157+
List<Article> articles = request.updateNotification().stream()
162158
.map(articleId -> {
163159
Article article = articleById.get(articleId);
164160
if (article == null) {

0 commit comments

Comments
 (0)