feat(home): 인기 커뮤니티 게시글 응답 필드를 추가한다
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -21,7 +21,7 @@ data class HomeRecommendationResponse(
|
||||
val aiCharacters: List<HomeAiCharacterItem>,
|
||||
val genreCreators: List<HomeGenreCreatorGroupItem>,
|
||||
val cheerCreators: List<HomeCreatorItem>,
|
||||
val popularCommunities: List<HomePopularCommunityItem>
|
||||
val popularCommunityPosts: List<HomePopularCommunityPostItem>
|
||||
)
|
||||
|
||||
data class HomeLiveItem(
|
||||
@@ -87,13 +87,16 @@ data class HomeGenreCreatorGroupItem(
|
||||
val creators: List<HomeCreatorItem>
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user