Skip to content

Feat/week 3#27

Open
junyi04 wants to merge 24 commits intoApptiveDev:강준이from
junyi04:feat/week-3
Open

Feat/week 3#27
junyi04 wants to merge 24 commits intoApptiveDev:강준이from
junyi04:feat/week-3

Conversation

@junyi04
Copy link
Copy Markdown

@junyi04 junyi04 commented Nov 14, 2025

변경점 👍

Member 생성

  • 멤버 조회
  • 멤버 검색
  • 좋아요 기능

비고 ✏

현재 글 작성시 author 필드에 문자열을 저장하는 방식으로 되어있음.
postEntity의 member 필드는 아무것도 넣고 있지 않아서
게시글을 적어도 멤버 상세 페이지에서는 그 게시글이 보이지 않음.

Copy link
Copy Markdown

@Martinel2 Martinel2 left a comment

Choose a reason for hiding this comment

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

3주차 과제도 수고하셨습니다!! 전반적인 코드 구성이 스프링MVC패턴에 맞춰 잘 짜여져있는 것 같아요. 테스트 코드를 작성해서 테스트하는 것과 예외처리부분만 신경쓰시면 더 좋은 코드를 짤 수 있을 것 같아요!

@PostMapping("/{commentId}/delete")
public String deleteComment(@PathVariable Long commentId, @RequestParam Long postId) {
commentService.deleteComment(commentId);
return "redirect:/posts/" + postId;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"redirect:/posts/" 와 같은 문자열들은 상수로 만들어 사용하시면, 추후에 링크가 변경되더라도 더 효율적으로 코드를 수정할 수 있을거 같아요

Comment on lines +21 to +24
public String list(Model model) {
model.addAttribute("members", memberService.getAllMembers());
return "member-list";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 메소드에서 model은 어떤 역할을 할까요?

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@RestController@controller의 차이는 무엇일까요?


// 특정 게시글 댓글 조회
public List<CommentResponse> getCommentsByPost(Long postId) {
PostEntity postEntity = postRepository.findById(postId).orElseThrow();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

orElseThrow()는 어떤 예외를 날릴까요?

Comment on lines +40 to +41
MemberEntity member = memberRepository.findById(memberId).orElseThrow();
PostEntity postEntity = postRepository.findById(postId).orElseThrow();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 부분을 하나로 묶어서 확인 과정 메소드를 만들면 다른 기능이 생기더라도 바로 적용할 수 있어서 좋을거 같아요!

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