feat(community): 댓글 비밀 여부를 응답한다
This commit is contained in:
@@ -81,6 +81,8 @@ data class CreatorChannelCommunityCommentResponse(
|
|||||||
val writerProfileImageUrl: String,
|
val writerProfileImageUrl: String,
|
||||||
val writerNickname: String,
|
val writerNickname: String,
|
||||||
val content: String,
|
val content: String,
|
||||||
|
@JsonProperty("isSecret")
|
||||||
|
val isSecret: Boolean,
|
||||||
val createdAtUtc: String,
|
val createdAtUtc: String,
|
||||||
val latestReply: CreatorChannelCommunityReplyResponse?
|
val latestReply: CreatorChannelCommunityReplyResponse?
|
||||||
) {
|
) {
|
||||||
@@ -92,6 +94,7 @@ data class CreatorChannelCommunityCommentResponse(
|
|||||||
writerProfileImageUrl = comment.writerProfileImageUrl,
|
writerProfileImageUrl = comment.writerProfileImageUrl,
|
||||||
writerNickname = comment.writerNickname,
|
writerNickname = comment.writerNickname,
|
||||||
content = comment.content,
|
content = comment.content,
|
||||||
|
isSecret = comment.isSecret,
|
||||||
createdAtUtc = comment.createdAt.toUtcIso(),
|
createdAtUtc = comment.createdAt.toUtcIso(),
|
||||||
latestReply = comment.latestReply?.let(CreatorChannelCommunityReplyResponse::from)
|
latestReply = comment.latestReply?.let(CreatorChannelCommunityReplyResponse::from)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ class CreatorChannelCommunityControllerTest @Autowired constructor(
|
|||||||
.andExpect(jsonPath("$.data.isLiked").value(true))
|
.andExpect(jsonPath("$.data.isLiked").value(true))
|
||||||
.andExpect(jsonPath("$.data.comments.commentCount").value(1))
|
.andExpect(jsonPath("$.data.comments.commentCount").value(1))
|
||||||
.andExpect(jsonPath("$.data.comments.comments[0].writerId").value(20))
|
.andExpect(jsonPath("$.data.comments.comments[0].writerId").value(20))
|
||||||
|
.andExpect(jsonPath("$.data.comments.comments[0].isSecret").value(true))
|
||||||
.andExpect(jsonPath("$.data.comments.comments[0].latestReply.commentId").value(202))
|
.andExpect(jsonPath("$.data.comments.comments[0].latestReply.commentId").value(202))
|
||||||
.andExpect(jsonPath("$.data.comments.comments[0].latestReply.writerId").value(21))
|
.andExpect(jsonPath("$.data.comments.comments[0].latestReply.writerId").value(21))
|
||||||
}
|
}
|
||||||
@@ -206,6 +207,7 @@ class CreatorChannelCommunityControllerTest @Autowired constructor(
|
|||||||
.andExpect(status().isOk)
|
.andExpect(status().isOk)
|
||||||
.andExpect(jsonPath("$.data.commentCount").value(1))
|
.andExpect(jsonPath("$.data.commentCount").value(1))
|
||||||
.andExpect(jsonPath("$.data.comments[0].writerId").value(20))
|
.andExpect(jsonPath("$.data.comments[0].writerId").value(20))
|
||||||
|
.andExpect(jsonPath("$.data.comments[0].isSecret").value(true))
|
||||||
.andExpect(jsonPath("$.data.comments[0].latestReply.commentId").value(202))
|
.andExpect(jsonPath("$.data.comments[0].latestReply.commentId").value(202))
|
||||||
.andExpect(jsonPath("$.data.comments[0].latestReply.writerId").value(21))
|
.andExpect(jsonPath("$.data.comments[0].latestReply.writerId").value(21))
|
||||||
.andExpect(jsonPath("$.data.hasNext").value(false))
|
.andExpect(jsonPath("$.data.hasNext").value(false))
|
||||||
@@ -377,6 +379,7 @@ class CreatorChannelCommunityControllerTest @Autowired constructor(
|
|||||||
writerProfileImageUrl = "https://cdn.test/writer.png",
|
writerProfileImageUrl = "https://cdn.test/writer.png",
|
||||||
writerNickname = "writer",
|
writerNickname = "writer",
|
||||||
content = "comment",
|
content = "comment",
|
||||||
|
isSecret = true,
|
||||||
createdAtUtc = "2026-07-06T03:00:00Z",
|
createdAtUtc = "2026-07-06T03:00:00Z",
|
||||||
latestReply = CreatorChannelCommunityReplyResponse(
|
latestReply = CreatorChannelCommunityReplyResponse(
|
||||||
commentId = 202L,
|
commentId = 202L,
|
||||||
|
|||||||
@@ -204,7 +204,9 @@ class CreatorChannelCommunityEndToEndTest @Autowired constructor(
|
|||||||
.andExpect(jsonPath("$.data.commentCount").value(2))
|
.andExpect(jsonPath("$.data.commentCount").value(2))
|
||||||
.andExpect(jsonPath("$.data.comments.length()").value(2))
|
.andExpect(jsonPath("$.data.comments.length()").value(2))
|
||||||
.andExpect(jsonPath("$.data.comments[0].commentId").value(fixture.ownSecretCommentId))
|
.andExpect(jsonPath("$.data.comments[0].commentId").value(fixture.ownSecretCommentId))
|
||||||
|
.andExpect(jsonPath("$.data.comments[0].isSecret").value(true))
|
||||||
.andExpect(jsonPath("$.data.comments[1].commentId").value(fixture.publicCommentId))
|
.andExpect(jsonPath("$.data.comments[1].commentId").value(fixture.publicCommentId))
|
||||||
|
.andExpect(jsonPath("$.data.comments[1].isSecret").value(false))
|
||||||
.andExpect(jsonPath("$.data.comments[1].latestReply.commentId").value(fixture.publicReplyId))
|
.andExpect(jsonPath("$.data.comments[1].latestReply.commentId").value(fixture.publicReplyId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
assertTrue(response.isLiked)
|
assertTrue(response.isLiked)
|
||||||
assertEquals(1, response.comments.commentCount)
|
assertEquals(1, response.comments.commentCount)
|
||||||
assertEquals(20L, response.comments.comments.first().writerId)
|
assertEquals(20L, response.comments.comments.first().writerId)
|
||||||
|
assertTrue(response.comments.comments.first().isSecret)
|
||||||
assertEquals(21L, response.comments.comments.first().latestReply?.writerId)
|
assertEquals(21L, response.comments.comments.first().latestReply?.writerId)
|
||||||
assertEquals(201L, response.comments.comments.first().latestReply?.commentId)
|
assertEquals(201L, response.comments.comments.first().latestReply?.commentId)
|
||||||
}
|
}
|
||||||
@@ -126,6 +127,7 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
assertEquals(0, response.page)
|
assertEquals(0, response.page)
|
||||||
assertEquals(20, response.size)
|
assertEquals(20, response.size)
|
||||||
assertEquals(20L, response.comments.first().writerId)
|
assertEquals(20L, response.comments.first().writerId)
|
||||||
|
assertTrue(response.comments.first().isSecret)
|
||||||
assertEquals(21L, response.comments.first().latestReply?.writerId)
|
assertEquals(21L, response.comments.first().latestReply?.writerId)
|
||||||
assertEquals(201L, response.comments.first().latestReply?.commentId)
|
assertEquals(201L, response.comments.first().latestReply?.commentId)
|
||||||
}
|
}
|
||||||
@@ -217,6 +219,7 @@ class CreatorChannelCommunityFacadeTest {
|
|||||||
writerProfileImageUrl = "https://cdn.test/writer.png",
|
writerProfileImageUrl = "https://cdn.test/writer.png",
|
||||||
writerNickname = "writer",
|
writerNickname = "writer",
|
||||||
content = "comment",
|
content = "comment",
|
||||||
|
isSecret = true,
|
||||||
createdAt = LocalDateTime.of(2026, 7, 6, 3, 0),
|
createdAt = LocalDateTime.of(2026, 7, 6, 3, 0),
|
||||||
latestReply = createReplies().replies.first()
|
latestReply = createReplies().replies.first()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class CreatorChannelCommunityPostDetailResponseTest {
|
|||||||
assertTrue(detailJson["comments"]["hasNext"].asBoolean())
|
assertTrue(detailJson["comments"]["hasNext"].asBoolean())
|
||||||
assertTrue(detailJson["comments"]["comments"][0].has("latestReply"))
|
assertTrue(detailJson["comments"]["comments"][0].has("latestReply"))
|
||||||
assertTrue(detailJson["comments"]["comments"][0].has("writerId"))
|
assertTrue(detailJson["comments"]["comments"][0].has("writerId"))
|
||||||
|
assertTrue(detailJson["comments"]["comments"][0]["isSecret"].asBoolean())
|
||||||
assertTrue(detailJson["comments"]["comments"][0]["latestReply"].has("commentId"))
|
assertTrue(detailJson["comments"]["comments"][0]["latestReply"].has("commentId"))
|
||||||
assertTrue(detailJson["comments"]["comments"][0]["latestReply"].has("writerId"))
|
assertTrue(detailJson["comments"]["comments"][0]["latestReply"].has("writerId"))
|
||||||
assertTrue(repliesJson["hasNext"].asBoolean())
|
assertTrue(repliesJson["hasNext"].asBoolean())
|
||||||
@@ -75,6 +76,7 @@ class CreatorChannelCommunityPostDetailResponseTest {
|
|||||||
writerProfileImageUrl = "https://cdn.test/comment.png",
|
writerProfileImageUrl = "https://cdn.test/comment.png",
|
||||||
writerNickname = "comment-writer",
|
writerNickname = "comment-writer",
|
||||||
content = "comment",
|
content = "comment",
|
||||||
|
isSecret = true,
|
||||||
createdAt = LocalDateTime.of(2026, 7, 6, 3, 0),
|
createdAt = LocalDateTime.of(2026, 7, 6, 3, 0),
|
||||||
latestReply = reply
|
latestReply = reply
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user