diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/application/HomeRecommendationFacade.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/application/HomeRecommendationFacade.kt index dbb8db98..4cd5ab52 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/application/HomeRecommendationFacade.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/application/HomeRecommendationFacade.kt @@ -10,7 +10,7 @@ import kr.co.vividnext.sodalive.v2.api.home.dto.HomeCreatorItem import kr.co.vividnext.sodalive.v2.api.home.dto.HomeFirstAudioContentItem import kr.co.vividnext.sodalive.v2.api.home.dto.HomeGenreCreatorGroupItem import kr.co.vividnext.sodalive.v2.api.home.dto.HomeLiveItem -import kr.co.vividnext.sodalive.v2.api.home.dto.HomePopularCommunityItem +import kr.co.vividnext.sodalive.v2.api.home.dto.HomePopularCommunityPostItem import kr.co.vividnext.sodalive.v2.api.home.dto.HomeRecommendationPageResponse import kr.co.vividnext.sodalive.v2.api.home.dto.HomeRecommendationResponse import kr.co.vividnext.sodalive.v2.api.home.dto.imageUrl @@ -81,7 +81,7 @@ class HomeRecommendationFacade( ).map { it.toItem() }, cheerCreators = queryService.findCheerCreatorRecommendations(HOME_CHEER_CREATOR_LIMIT, member?.id) .map { it.toCreatorItem() }, - popularCommunities = queryService.findPopularCommunityRecommendations( + popularCommunityPosts = queryService.findPopularCommunityRecommendations( limit = HOME_POPULAR_COMMUNITY_LIMIT, memberId = member?.id, includeAdultCommunities = includeAdult @@ -205,7 +205,7 @@ class HomeRecommendationFacade( if (aiCharacters.isEmpty()) add("aiCharacters") if (genreCreators.isEmpty()) add("genreCreators") if (cheerCreators.isEmpty()) add("cheerCreators") - if (popularCommunities.isEmpty()) add("popularCommunities") + if (popularCommunityPosts.isEmpty()) add("popularCommunityPosts") } } @@ -301,15 +301,18 @@ class HomeRecommendationFacade( creatorProfileImage = imageUrl(cloudFrontHost, creatorProfileImage) ) - private fun HomePopularCommunityRecommendationRecord.toItem() = HomePopularCommunityItem( - communityId = communityId, + private fun HomePopularCommunityRecommendationRecord.toItem() = HomePopularCommunityPostItem( + postId = communityId, creatorId = creatorId, creatorNickname = creatorNickname, creatorProfileImage = imageUrl(cloudFrontHost, creatorProfileImage), + imageUrl = imageUrl(cloudFrontHost, imagePath), + audioUrl = imageUrl(cloudFrontHost, audioPath), content = content, createdAt = createdAt.toUtcIso(), likeCount = likeCount, - commentCount = commentCount + commentCount = commentCount, + existOrdered = existOrdered ) companion object { diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponse.kt index cc8495d4..04f916af 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponse.kt @@ -21,7 +21,7 @@ data class HomeRecommendationResponse( val aiCharacters: List, val genreCreators: List, val cheerCreators: List, - val popularCommunities: List + val popularCommunityPosts: List ) data class HomeLiveItem( @@ -87,13 +87,16 @@ data class HomeGenreCreatorGroupItem( val creators: List ) -data class HomePopularCommunityItem( - val communityId: Long, +data class HomePopularCommunityPostItem( + val postId: Long, val creatorId: Long, val creatorNickname: String, val creatorProfileImage: String?, + val imageUrl: String?, + val audioUrl: String?, val content: String, val createdAt: String, val likeCount: Long, - val commentCount: Long + val commentCount: Long, + val existOrdered: Boolean ) diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponseTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponseTest.kt index cbeef69d..ebe72bab 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponseTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/dto/HomeRecommendationResponseTest.kt @@ -39,7 +39,21 @@ class HomeRecommendationResponseTest { ), genreCreators = emptyList(), cheerCreators = emptyList(), - popularCommunities = emptyList() + popularCommunityPosts = listOf( + HomePopularCommunityPostItem( + postId = 5L, + creatorId = 6L, + creatorNickname = "community-creator", + creatorProfileImage = "https://cdn.test/profile/community.png", + imageUrl = "https://cdn.test/community/image.png", + audioUrl = "https://cdn.test/community/audio.mp3", + content = "community content", + createdAt = "2026-06-01T00:00:00Z", + likeCount = 7L, + commentCount = 8L, + existOrdered = true + ) + ) ) val json = objectMapper.readTree(objectMapper.writeValueAsString(response)) @@ -47,5 +61,9 @@ class HomeRecommendationResponseTest { assertEquals(true, json["firstAudioContents"][0]["isPointAvailable"].asBoolean()) assertFalse(json["firstAudioContents"][0].has("pointAvailable")) assertEquals("https://cdn.test/profile/character.png", json["aiCharacters"][0]["profileImage"].asText()) + assertEquals(5L, json["popularCommunityPosts"][0]["postId"].asLong()) + assertEquals("https://cdn.test/community/image.png", json["popularCommunityPosts"][0]["imageUrl"].asText()) + assertEquals("https://cdn.test/community/audio.mp3", json["popularCommunityPosts"][0]["audioUrl"].asText()) + assertEquals(true, json["popularCommunityPosts"][0]["existOrdered"].asBoolean()) } }