Open
Conversation
Martinel2
approved these changes
Nov 23, 2025
Martinel2
left a comment
There was a problem hiding this comment.
3주차 과제도 수고하셨습니다!! 전반적인 코드 구성이 스프링MVC패턴에 맞춰 잘 짜여져있는 것 같아요. 테스트 코드를 작성해서 테스트하는 것과 예외처리부분만 신경쓰시면 더 좋은 코드를 짤 수 있을 것 같아요!
| @PostMapping("/{commentId}/delete") | ||
| public String deleteComment(@PathVariable Long commentId, @RequestParam Long postId) { | ||
| commentService.deleteComment(commentId); | ||
| return "redirect:/posts/" + postId; |
There was a problem hiding this comment.
"redirect:/posts/" 와 같은 문자열들은 상수로 만들어 사용하시면, 추후에 링크가 변경되더라도 더 효율적으로 코드를 수정할 수 있을거 같아요
Comment on lines
+21
to
+24
| public String list(Model model) { | ||
| model.addAttribute("members", memberService.getAllMembers()); | ||
| return "member-list"; | ||
| } |
| import org.springframework.ui.Model; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| @Controller |
There was a problem hiding this comment.
@RestController와 @controller의 차이는 무엇일까요?
|
|
||
| // 특정 게시글 댓글 조회 | ||
| public List<CommentResponse> getCommentsByPost(Long postId) { | ||
| PostEntity postEntity = postRepository.findById(postId).orElseThrow(); |
Comment on lines
+40
to
+41
| MemberEntity member = memberRepository.findById(memberId).orElseThrow(); | ||
| PostEntity postEntity = postRepository.findById(postId).orElseThrow(); |
There was a problem hiding this comment.
이 부분을 하나로 묶어서 확인 과정 메소드를 만들면 다른 기능이 생기더라도 바로 적용할 수 있어서 좋을거 같아요!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경점 👍
Member 생성
비고 ✏
현재 글 작성시 author 필드에 문자열을 저장하는 방식으로 되어있음.
postEntity의 member 필드는 아무것도 넣고 있지 않아서
게시글을 적어도 멤버 상세 페이지에서는 그 게시글이 보이지 않음.