Skip to content

Commit

Permalink
โ™ป๏ธ change version of user comment list
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxrxn committed Dec 13, 2024
1 parent a25aba5 commit 1c54694
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void deleteComment(@PathVariable long commentId, @LoginUser UserInfo user
commentService.deleteComment(commentId, userInfo);
}

@GetMapping("/mine")
public List<CommentOfUserResponse> readCommentsOfMe(@LoginUser UserInfo userInfo) {
return commentService.readCommentsOfUser(userInfo);
@GetMapping(value = "/mine", produces = "application/vnd.pengcook.v1+json")
public List<CommentOfUserResponse> readCommentsOfMeV1(@LoginUser UserInfo userInfo) {
return commentService.readCommentsOfUserV1(userInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void deleteCommentsByUser(long userId) {
}

@Transactional(readOnly = true)
public List<CommentOfUserResponse> readCommentsOfUser(UserInfo userInfo) {
public List<CommentOfUserResponse> readCommentsOfUserV1(UserInfo userInfo) {
List<Comment> comments = commentRepository.findAllByUserId(userInfo.getId());

return comments.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void deleteCommentWhenNotCommentOwner() {
@Test
@WithLoginUser(email = "loki@pengcook.net")
@DisplayName("๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž์˜ ๋Œ“๊ธ€์„ ์กฐํšŒํ•œ๋‹ค.")
void readCommentsOfUser() {
void readCommentsOfUserV1() {
RestAssured.given(spec).log().all()
.filter(document(DEFAULT_RESTDOCS_PATH,
"๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž์˜ ๋Œ“๊ธ€์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.",
Expand All @@ -190,6 +190,7 @@ void readCommentsOfUser() {
fieldWithPath("[].createdAt").description("์ž‘์„ฑ ์‹œ๊ฐ„"),
fieldWithPath("[].message").description("๋‚ด์šฉ")
)))
.accept("application/vnd.pengcook.v1+json")
.when().get("/comments/mine")
.then().log().all()
.body("size()", is(COMMENT_COUNT_OF_LOKI));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void readCommentsOfUser() {
new CommentOfUserResponse(3L, 2L, "๊น€์น˜์ฐŒ๊ฐœ", LocalDateTime.of(2024, 5, 5, 0, 0, 0), "good")
);

List<CommentOfUserResponse> actual = commentService.readCommentsOfUser(userInfo);
List<CommentOfUserResponse> actual = commentService.readCommentsOfUserV1(userInfo);

assertThat(actual).containsExactlyInAnyOrderElementsOf(expect);
}
Expand Down

0 comments on commit 1c54694

Please sign in to comment.