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

fix: 댓글 생성, 조회 수정 #52

Merged
merged 6 commits into from
Mar 5, 2024
Merged

fix: 댓글 생성, 조회 수정 #52

merged 6 commits into from
Mar 5, 2024

Conversation

jihyo-j
Copy link
Member

@jihyo-j jihyo-j commented Mar 5, 2024

  • 댓글 생성
    userId 요청 제거

  • 댓글 조회
    요청변수로 advertiseId

@GetMapping("/all")
public ResponseEntity<List<CommentDetail>> getAllComments() {
List<CommentDetail> comments = commentService.getAllComments();
public ResponseEntity<List<CommentDetail>> getAllComments(@RequestParam Long advertiseId) {
Copy link
Member

Choose a reason for hiding this comment

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

path variable을 사용하는게 좀 더 깔끔할것같아 url도 /api/advertises/comments/{advertiseId} 이런느낌으로 자원을 명시해주는게 좀 더 좋을것같아

return comments.stream()
.map(comment -> new CommentDetail(comment.getCommentId(), comment.getContent(), comment.getCommenterId()))
.map(comment -> new CommentDetail(comment.getCommentId(), comment.getContent()))
Copy link
Member

Choose a reason for hiding this comment

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

와이어프레임에 댓글 작성자 이름도 있어서 email이라도 간단하게 적어주면 좋을 것 같아

public ResponseEntity<List<CommentDetail>> getAllComments() {
List<CommentDetail> comments = commentService.getAllComments();
@Operation(summary = "댓글 조회")
@GetMapping("comments/{advertiseId}")
Copy link
Member

Choose a reason for hiding this comment

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

/comments 부분이 반복되서 지워주라

@jihyo-j jihyo-j merged commit dd6a3ea into main Mar 5, 2024
1 check passed
@jihyo-j jihyo-j deleted the chore/Comment branch March 5, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants