diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderService.java b/src/main/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderService.java index 2f07f53f..c9a7967a 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderService.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderService.java @@ -16,6 +16,7 @@ import org.tuna.zoopzoop.backend.domain.datasource.repository.DataSourceRepository; import org.tuna.zoopzoop.backend.domain.member.entity.Member; import org.tuna.zoopzoop.backend.domain.member.repository.MemberRepository; +import org.tuna.zoopzoop.backend.domain.datasource.entity.Tag; import java.util.HashSet; import java.util.List; @@ -184,8 +185,11 @@ public FolderFilesDto getFilesInFolderForPersonal(Integer memberId, Integer fold ds.getSummary(), ds.getSourceUrl(), ds.getImageUrl(), - ds.getTags() == null ? List.of() : ds.getTags(), - ds.getCategory() == null ? null : ds.getCategory().toString() + ds.getTags() == null ? List.of() + : ds.getTags().stream() + .map(Tag::getTagName) + .toList(), + ds.getCategory() == null ? null : ds.getCategory().name() )) .toList(); diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/datasource/dto/FileSummary.java b/src/main/java/org/tuna/zoopzoop/backend/domain/datasource/dto/FileSummary.java index 66c9857a..8d90a415 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/datasource/dto/FileSummary.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/datasource/dto/FileSummary.java @@ -1,7 +1,5 @@ package org.tuna.zoopzoop.backend.domain.datasource.dto; -import org.tuna.zoopzoop.backend.domain.datasource.entity.Tag; - import java.time.LocalDate; import java.util.List; @@ -12,6 +10,8 @@ public record FileSummary( String summary, String sourceUrl, String imageUrl, - List tags, + List tags, String category ) {} + + diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/news/service/NewsService.java b/src/main/java/org/tuna/zoopzoop/backend/domain/news/service/NewsService.java index 440a3476..4ef7b5d2 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/news/service/NewsService.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/news/service/NewsService.java @@ -22,8 +22,10 @@ public List getTagFrequencyFromFiles(Integer memberId, Integer folderId) List files = folderFilesDto.files(); Map tags = files.stream() - .flatMap(file -> file.tags().stream()) - .map(tag -> tag.getTagName()) + .flatMap(file -> { + List ts = file.tags(); + return (ts == null ? List.of() : ts).stream(); + }) .collect(Collectors.groupingBy( tagName -> tagName, Collectors.counting() diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderServiceTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderServiceTest.java index 54e8dc5a..2d5da3dc 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderServiceTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/archive/folder/service/FolderServiceTest.java @@ -298,7 +298,7 @@ void getFilesInFolderForPersonal_success() { assertThat(f0.summary()).isEqualTo("요약 A"); assertThat(f0.sourceUrl()).isEqualTo("http://src/a"); assertThat(f0.imageUrl()).isEqualTo("http://img/a"); - assertThat(f0.tags()).extracting(Tag::getTagName).containsExactly("tag1", "tag2"); + assertThat(f0.tags()).containsExactly("tag1", "tag2"); } @Test diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/space/space/controller/ApiV1SpaceControllerTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/space/space/controller/ApiV1SpaceControllerTest.java index 2641cef5..6bca9b02 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/space/space/controller/ApiV1SpaceControllerTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/space/space/controller/ApiV1SpaceControllerTest.java @@ -8,7 +8,6 @@ import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.ResultActions; -import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.tuna.zoopzoop.backend.domain.member.enums.Provider; import org.tuna.zoopzoop.backend.domain.member.service.MemberService;