diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryService.kt index 4bb7ba4d..ea3893ab 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryService.kt @@ -121,7 +121,8 @@ class CreatorChannelCommunityQueryService( isCommentAvailable = isCommentAvailable, likeCount = likeCount, commentCount = commentCount, - isPinned = isPinned + isPinned = isPinned, + isLiked = isLiked ) } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityTab.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityTab.kt index 3790e03a..7705da17 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityTab.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityTab.kt @@ -24,5 +24,6 @@ data class CreatorChannelCommunityPost( val isCommentAvailable: Boolean, val likeCount: Int, val commentCount: Int, - val isPinned: Boolean + val isPinned: Boolean, + val isLiked: Boolean ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/port/out/CreatorChannelCommunityQueryPort.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/port/out/CreatorChannelCommunityQueryPort.kt index 2eaa4764..6517a1ce 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/port/out/CreatorChannelCommunityQueryPort.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/port/out/CreatorChannelCommunityQueryPort.kt @@ -51,5 +51,6 @@ data class CreatorChannelCommunityPostRecord( val isCommentAvailable: Boolean, val likeCount: Int, val commentCount: Int, - val isPinned: Boolean + val isPinned: Boolean, + val isLiked: Boolean ) diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryServiceTest.kt index afdd6a63..200fdf20 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/application/CreatorChannelCommunityQueryServiceTest.kt @@ -108,7 +108,7 @@ class CreatorChannelCommunityQueryServiceTest { fun shouldAssembleCommunityPostAssetsByAccessPolicy() { val port = FakeCreatorChannelCommunityQueryPort().apply { communityPosts = listOf( - communityPostRecord(1L, price = 0, existOrdered = false), + communityPostRecord(1L, price = 0, existOrdered = false, isLiked = true), communityPostRecord(2L, price = 100, existOrdered = true), communityPostRecord(3L, price = 100, existOrdered = false), communityPostRecord(4L, creatorId = 10L, price = 100, existOrdered = false, creatorProfilePath = null), @@ -131,6 +131,7 @@ class CreatorChannelCommunityQueryServiceTest { assertEquals("https://cdn.test/image/1.png", posts[0].imageUrl) assertEquals("https://signed.test/audio/1.mp3", posts[0].audioUrl) assertEquals("content-1", posts[0].content) + assertEquals(true, posts[0].isLiked) assertEquals("https://cdn.test/image/2.png", posts[1].imageUrl) assertEquals("https://signed.test/audio/2.mp3", posts[1].audioUrl) assertNull(posts[2].imageUrl) @@ -151,7 +152,7 @@ class CreatorChannelCommunityQueryServiceTest { val port = FakeCreatorChannelCommunityQueryPort().apply { creator = null blocked = true - homeCommunityPosts = listOf(communityPostRecord(1L, price = 0)) + homeCommunityPosts = listOf(communityPostRecord(1L, price = 0, isLiked = true)) } val service = createService(port) @@ -169,6 +170,7 @@ class CreatorChannelCommunityQueryServiceTest { assertEquals(true, port.homeIsPinned) assertEquals(false, port.homeCanViewAdultContent) assertEquals(3, port.homeLimit) + assertEquals(true, posts.single().isLiked) } private fun createService( @@ -284,7 +286,8 @@ private fun communityPostRecord( existOrdered: Boolean = false, creatorProfilePath: String? = "profile/$postId.png", imagePath: String? = "image/$postId.png", - audioPath: String? = "audio/$postId.mp3" + audioPath: String? = "audio/$postId.mp3", + isLiked: Boolean = false ): CreatorChannelCommunityPostRecord { return CreatorChannelCommunityPostRecord( postId = postId, @@ -300,6 +303,7 @@ private fun communityPostRecord( isCommentAvailable = true, likeCount = postId.toInt(), commentCount = postId.toInt() + 1, - isPinned = postId == 1L + isPinned = postId == 1L, + isLiked = isLiked ) } diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityQueryPolicyTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityQueryPolicyTest.kt index 307a33aa..d569ddf3 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityQueryPolicyTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/domain/CreatorChannelCommunityQueryPolicyTest.kt @@ -125,7 +125,8 @@ class CreatorChannelCommunityQueryPolicyTest { isCommentAvailable = true, likeCount = 2, commentCount = 3, - isPinned = true + isPinned = true, + isLiked = true ) ), page = page, @@ -150,7 +151,8 @@ class CreatorChannelCommunityQueryPolicyTest { isCommentAvailable = true, likeCount = 2, commentCount = 3, - isPinned = true + isPinned = true, + isLiked = true ) assertEquals(1, tab.communityPostCount) @@ -160,5 +162,6 @@ class CreatorChannelCommunityQueryPolicyTest { assertEquals(MemberRole.CREATOR, creatorRecord.role) assertNull(postRecord.imagePath) assertTrue(postRecord.isPinned) + assertTrue(postRecord.isLiked) } }