Skip to content

Conversation

@meena2003
Copy link
Member

1. 피드백 반영

  • .DS_Store 파일 삭제
  • orElse(null) 코드를 orElseThrow(new EmptyResultDataAccessException()) 으로 수정

2. Have Done

  • 게시글 작성 시 작성자 입력 필드 삭제 기능 구현
  • 로그인이 안된 상태로 ‘글 작성’, ‘글 제목’을 클릭하면 로그인 페이지로 이동 기능 구현
  • 로그인 한 계정과 글 작성자가 동일한 경우에만 글 수정 페이지로 이동 기능 구현
  • 게시글 수정 시, 기존의 제목과 내용이 출력되는 수정 페이지 구현
  • 로그인 한 계정과 글 작성자가 동일한 경우에 글 삭제 기능 구현

3. 느낀 점

  • 다른 사람들과 속도가 맞지 않고 미션 구현 속도가 느려서 함께 성장하지 못하고 점점 더 뒤쳐지고 있다는 생각에 심리적으로 위축 되었던 한 주였습니다. 그런 와중에 수업 시간에 등장하는 새로운 기술과 개념들이 부담으로 작용됐습니다. 기본적인 기능 구현도 힘든 상황인데 주변에서 테스트, 빌드 자동화, 예외처리에 대해서 이야기를 하니 더 의기소침했던 것 같습니다.
  • 하지만 문제는 미션이 아니라 모르는 것을 대하는 제 태도였다는 것을 느꼈습니다.
  • 테스트 코드에 대한 중요성을 많이 느낀 한 주였지만 테스트 코드를 작성하지 못해서 계속 마음에 걸립니다. 그러나 현재는 기능 구현에 집중하려고 합니다. 그래도 테스트 코드에 대한 필요성을 계속 인지할 것입니다.

4. 궁금한 점

  • 세션 정보와 DB에 저장된 데이터를 비교하는 로직을 어디서 해야할지 고민하다가 controller에서 했습니다. 맞는지 궁금합니다.
  • 루카스 미션 소개 페이지나 다른 팀원들의 이야기를 들어보면 이번 미션5부터 article 테이블에 userId를 FK로 가져야 한다고 합니다. 하지만 제가 기능을 구현할 때 해당 FK를 사용하지 않았습니다. 뭔가 놓치고 있는 부분이 있는지 혼란스럽습니다..ㅎㅎ

qan/form.html 파일에서 작성자 입력 필드 삭제
askQuestion() 메소드 생성한 후 Session을 가지고 와서 null인 경우 로그인 페이지로 리다이렉트 실행
일치하지 않을 경우 '글 작성자만 수정할 수 있습니다' 오류페이지로 이동
로그인한 계정의 게시글을 삭제 시도할 경우 실패 페이지가 나옴
값이 null일 경우 EmptyResultDataAccessException이 발생하도록 수정함
@meena2003 meena2003 changed the title [core] (step-5) [core] (step-5) 게시글 권한 부여 [게시글 열람, 수정, 삭제 권한] Mar 31, 2023
public String login(Member member, HttpSession httpSession) {
Member loginMember = memberService.findOneMemberByEmail(member.getEmail()).orElse(null);
Member loginMember = memberService.findOneMemberByEmail(member.getEmail()).orElseThrow(() -> new EmptyResultDataAccessException(1));
if (loginMember != null && memberService.checkMember(loginMember, member)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

loginMember != null 코드는 의미가 없기 때문에 제거해 주는 게 좋습니다. 왜 그런지 생각해 보세요.

Comment on lines +23 to +24
@GetMapping("/qna/article")
public String askQuestion(HttpSession httpSession) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@GetMapping("/qna/article")
public String askQuestion(HttpSession httpSession) {
@GetMapping("/qna/articleForm")
public String askQuestionForm(HttpSession httpSession) {

form 을 리턴해 주는 경우 명시적으로 URL 등에 form 이 들어가는 게 좋을 것 같아요.

@PostMapping("/qna/ask")
public String registerArticle(Article article) {
public String registerArticle(Article article, HttpSession httpSession) {
Member loginMember = (Member) httpSession.getAttribute("sessionedUser");
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 로그인이 안 되었을 경우 처리가 필요합니다.

Copy link
Contributor

@honux77 honux77 left a comment

Choose a reason for hiding this comment

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

지금 보면 글쓰기나 업데이트 요청 등에 권한 검증이 제대로 안 되어 있는 것 같아요.
추후 다음 단계에서 수정해 보세요.

Copy link
Contributor

@honux77 honux77 left a comment

Choose a reason for hiding this comment

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

마지막이라 approve 했다가 아무래도 아니라서 변경 요청 보냈습니다. 추후 업데이트해주세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants