feat(community): 커뮤니티 탭 좋아요 응답을 추가한다
This commit is contained in:
@@ -42,7 +42,9 @@ data class CreatorChannelCommunityPostResponse(
|
|||||||
val likeCount: Int,
|
val likeCount: Int,
|
||||||
val commentCount: Int,
|
val commentCount: Int,
|
||||||
@JsonProperty("isPinned")
|
@JsonProperty("isPinned")
|
||||||
val isPinned: Boolean
|
val isPinned: Boolean,
|
||||||
|
@JsonProperty("isLiked")
|
||||||
|
val isLiked: Boolean
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
fun from(post: CreatorChannelCommunityPost): CreatorChannelCommunityPostResponse {
|
fun from(post: CreatorChannelCommunityPost): CreatorChannelCommunityPostResponse {
|
||||||
@@ -60,7 +62,8 @@ data class CreatorChannelCommunityPostResponse(
|
|||||||
existOrdered = post.existOrdered,
|
existOrdered = post.existOrdered,
|
||||||
likeCount = post.likeCount,
|
likeCount = post.likeCount,
|
||||||
commentCount = post.commentCount,
|
commentCount = post.commentCount,
|
||||||
isPinned = post.isPinned
|
isPinned = post.isPinned,
|
||||||
|
isLiked = post.isLiked
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class CreatorChannelCommunityControllerTest @Autowired constructor(
|
|||||||
.andExpect(jsonPath("$.data.communityPosts[0].existOrdered").value(true))
|
.andExpect(jsonPath("$.data.communityPosts[0].existOrdered").value(true))
|
||||||
.andExpect(jsonPath("$.data.communityPosts[0].isCommentAvailable").value(true))
|
.andExpect(jsonPath("$.data.communityPosts[0].isCommentAvailable").value(true))
|
||||||
.andExpect(jsonPath("$.data.communityPosts[0].isPinned").value(true))
|
.andExpect(jsonPath("$.data.communityPosts[0].isPinned").value(true))
|
||||||
|
.andExpect(jsonPath("$.data.communityPosts[0].isLiked").value(true))
|
||||||
.andExpect(jsonPath("$.data.page").value(1))
|
.andExpect(jsonPath("$.data.page").value(1))
|
||||||
.andExpect(jsonPath("$.data.size").value(20))
|
.andExpect(jsonPath("$.data.size").value(20))
|
||||||
.andExpect(jsonPath("$.data.hasNext").value(false))
|
.andExpect(jsonPath("$.data.hasNext").value(false))
|
||||||
@@ -184,7 +185,8 @@ class CreatorChannelCommunityControllerTest @Autowired constructor(
|
|||||||
existOrdered = true,
|
existOrdered = true,
|
||||||
likeCount = 7,
|
likeCount = 7,
|
||||||
commentCount = 3,
|
commentCount = 3,
|
||||||
isPinned = true
|
isPinned = true,
|
||||||
|
isLiked = true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
page = page,
|
page = page,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
assertEquals(7, response.communityPosts.first().likeCount)
|
assertEquals(7, response.communityPosts.first().likeCount)
|
||||||
assertEquals(3, response.communityPosts.first().commentCount)
|
assertEquals(3, response.communityPosts.first().commentCount)
|
||||||
assertTrue(response.communityPosts.first().isPinned)
|
assertTrue(response.communityPosts.first().isPinned)
|
||||||
|
assertTrue(response.communityPosts.first().isLiked)
|
||||||
assertNull(response.communityPosts.last().imageUrl)
|
assertNull(response.communityPosts.last().imageUrl)
|
||||||
assertNull(response.communityPosts.last().audioUrl)
|
assertNull(response.communityPosts.last().audioUrl)
|
||||||
assertEquals(1, response.page)
|
assertEquals(1, response.page)
|
||||||
@@ -50,6 +51,7 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
assertTrue(json["hasNext"].asBoolean())
|
assertTrue(json["hasNext"].asBoolean())
|
||||||
assertTrue(json["communityPosts"][0]["isCommentAvailable"].asBoolean())
|
assertTrue(json["communityPosts"][0]["isCommentAvailable"].asBoolean())
|
||||||
assertTrue(json["communityPosts"][0]["isPinned"].asBoolean())
|
assertTrue(json["communityPosts"][0]["isPinned"].asBoolean())
|
||||||
|
assertTrue(json["communityPosts"][0]["isLiked"].asBoolean())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -112,7 +114,8 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
isCommentAvailable = true,
|
isCommentAvailable = true,
|
||||||
likeCount = 7,
|
likeCount = 7,
|
||||||
commentCount = 3,
|
commentCount = 3,
|
||||||
isPinned = true
|
isPinned = true,
|
||||||
|
isLiked = true
|
||||||
),
|
),
|
||||||
CreatorChannelCommunityPost(
|
CreatorChannelCommunityPost(
|
||||||
postId = 102L,
|
postId = 102L,
|
||||||
@@ -128,7 +131,8 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
isCommentAvailable = false,
|
isCommentAvailable = false,
|
||||||
likeCount = 1,
|
likeCount = 1,
|
||||||
commentCount = 0,
|
commentCount = 0,
|
||||||
isPinned = false
|
isPinned = false,
|
||||||
|
isLiked = false
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
page = CreatorChannelPage(page = 1, size = 20),
|
page = CreatorChannelPage(page = 1, size = 20),
|
||||||
|
|||||||
Reference in New Issue
Block a user