feat(community): 채널 커뮤니티 좋아요 모델을 추가한다

This commit is contained in:
2026-06-30 01:09:13 +09:00
parent 2789670615
commit 16ec1240bb
5 changed files with 19 additions and 9 deletions

View File

@@ -121,7 +121,8 @@ class CreatorChannelCommunityQueryService(
isCommentAvailable = isCommentAvailable,
likeCount = likeCount,
commentCount = commentCount,
isPinned = isPinned
isPinned = isPinned,
isLiked = isLiked
)
}

View File

@@ -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
)

View File

@@ -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
)

View File

@@ -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
)
}

View File

@@ -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)
}
}