Skip to content

Commit

Permalink
✨ 댓글에 isPrivate 필드 추가 (#288)
Browse files Browse the repository at this point in the history
* ✨ 댓글에 isPrivate 필드 추가

* 📝 댓글 Test Code, Rest Docs 에 isPrivate 필드 추가

* CreateComment 롤백, 기존 스키마에 맞게 GetComment 수정
  • Loading branch information
hwgyun authored Dec 12, 2024
1 parent f6ddb9d commit 2903ce8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ class GetCommentsDto {
val createdAt: LocalDateTime,
val createdBy: String,
val writer: String,
val isPrivate: Boolean,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class CommentService(
it.status,
it.createdAt,
it.createdBy,
it.member.nickname!!
it.member.nickname!!,
it.visibility.isPrivate
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class CommunityPostCommentControllerDocsTest : CommonDocsTestConfig() {
status = CommentType.CREATED,
LocalDateTime.now(),
"작성자 ID",
"작성자 닉네임"
"작성자 닉네임",
true
),
childComments = listOf(
GetCommentsDto.Comment(
Expand All @@ -52,6 +53,7 @@ class CommunityPostCommentControllerDocsTest : CommonDocsTestConfig() {
LocalDateTime.now(),
"작성자 ID",
"작성자 닉네임"
,false
)
)
)
Expand Down Expand Up @@ -85,15 +87,17 @@ class CommunityPostCommentControllerDocsTest : CommonDocsTestConfig() {
fieldWithPath("result.comments[].parentComment.status").type("CommentType").description("코멘트 상태").attributes(getFormatAttribute("CREATED, DELETED")),
fieldWithPath("result.comments[].parentComment.createdAt").type("LocalDateTime").description("작성일자"),
fieldWithPath("result.comments[].parentComment.createdBy").type(JsonFieldType.STRING).description("작성자 ID"),
fieldWithPath("result.comments[].parentComment.writer").type(JsonFieldType.STRING).description("작성자 닉네임"),
fieldWithPath("result.comments[].parentComment.writer").type(JsonFieldType.STRING).description("작성자 닉네임"), fieldWithPath("result.comments[].parentComment.writer").type(JsonFieldType.STRING).description("작성자 닉네임"),
fieldWithPath("result.comments[].parentComment.isPrivate").type(JsonFieldType.BOOLEAN).description("비공개 여부").optional(),
fieldWithPath("result.comments[].childComments[].id").type(JsonFieldType.NUMBER).description("코멘트 아이디"),
fieldWithPath("result.comments[].childComments[].upperCommentId").type(JsonFieldType.NUMBER).description("상위 코멘트 아이디").optional(),
fieldWithPath("result.comments[].childComments[].content").type(JsonFieldType.STRING).description("코멘트 내용"),
fieldWithPath("result.comments[].childComments[].status").type("CommentType").description("코멘트 상태").attributes(getFormatAttribute("CREATED, DELETED")),
fieldWithPath("result.comments[].childComments[].createdAt").type("LocalDateTime").description("작성일자"),
fieldWithPath("result.comments[].childComments[].createdBy").type(JsonFieldType.STRING).description("작성자 ID"),
fieldWithPath("result.comments[].childComments[].writer").type(JsonFieldType.STRING).description("작성자 닉네임"),
)
fieldWithPath("result.comments[].childComments[].isPrivate").type(JsonFieldType.BOOLEAN).description("비공개 여부").optional(),
)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class LostPostCommentControllerDocsTest : CommonDocsTestConfig() {
status = CommentType.CREATED,
LocalDateTime.now(),
"작성자 ID",
"작성자 닉네임"
"작성자 닉네임",
true
),
childComments = listOf(
GetCommentsDto.Comment(
Expand All @@ -51,7 +52,8 @@ class LostPostCommentControllerDocsTest : CommonDocsTestConfig() {
status = CommentType.CREATED,
LocalDateTime.now(),
"작성자 ID",
"작성자 닉네임"
"작성자 닉네임",
false
)
)
)
Expand Down Expand Up @@ -86,14 +88,16 @@ class LostPostCommentControllerDocsTest : CommonDocsTestConfig() {
fieldWithPath("result.comments[].parentComment.createdAt").type("LocalDateTime").description("작성일자"),
fieldWithPath("result.comments[].parentComment.createdBy").type(JsonFieldType.STRING).description("작성자 ID"),
fieldWithPath("result.comments[].parentComment.writer").type(JsonFieldType.STRING).description("작성자 닉네임"),
fieldWithPath("result.comments[].parentComment.isPrivate").type(JsonFieldType.BOOLEAN).description("비공개 여부").optional(),
fieldWithPath("result.comments[].childComments[].id").type(JsonFieldType.NUMBER).description("코멘트 아이디"),
fieldWithPath("result.comments[].childComments[].upperCommentId").type(JsonFieldType.NUMBER).description("상위 코멘트 아이디").optional(),
fieldWithPath("result.comments[].childComments[].content").type(JsonFieldType.STRING).description("코멘트 내용"),
fieldWithPath("result.comments[].childComments[].status").type("CommentType").description("코멘트 상태").attributes(getFormatAttribute("CREATED, DELETED")),
fieldWithPath("result.comments[].childComments[].createdAt").type("LocalDateTime").description("작성일자"),
fieldWithPath("result.comments[].childComments[].createdBy").type(JsonFieldType.STRING).description("작성자 ID"),
fieldWithPath("result.comments[].childComments[].writer").type(JsonFieldType.STRING).description("작성자 닉네임"),
)
fieldWithPath("result.comments[].childComments[].isPrivate").type(JsonFieldType.BOOLEAN).description("비공개 여부").optional(),
)
)
)
}
Expand Down

0 comments on commit 2903ce8

Please sign in to comment.