Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ change version of user comment list #433

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 리뷰 보다는 생각해볼만한 거리인것 같은데 추후에도 계속 모든 메서드에 버전이 추가되면 항상 produces = "application/vnd.pengcook.v1+json이 반복되게 될것 같아 나중에 불편하지 않을까 생각이 들었어요. 다음 회의때 같이 고민해보면 좋지 않을까 생각합니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞는 말이네요. 작성도 불편하고 확인도 불편하겠어요!
회의록을 미리 만들어서 의견 업로드 해뒀습니다~
다음 회의 때 같이 이야기해보아요.

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 = "[email protected]")
@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
Loading