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

[4단계] 구현 완료했습니다. 리뷰 부탁드립니다 #41

Open
wants to merge 8 commits into
base: kikat
Choose a base branch
from

Conversation

sunghyuki
Copy link
Collaborator

요구사항

질문 삭제 기능 구현

  • 질문 데이터를 삭제 상태로 변경
    • 그럼 삭제가 가능한 경우는?
      • 로그인 사용자와 질문한 사람이 같은 경우
        • 답변이 없는 경우
        • 질문자와 답변 글의 모든 답변자 같은 경우
  • 질문을 삭제할 때 답변 또한 삭제해야 하며, 답변의 삭제 또한 삭제 상태로 변경
    • 그럼 삭제가 가능한 경우?
      • 질문자와 답변자가 다른 경우 답변을 삭제할 수 없다.
  • 질문과 답변 삭제 이력에 대한 정보를 DeleteHistory를 활용해 남긴다.

User, Question, Answer 협력을 통한 구현

AcceptanceTest는 클라이언트 관점에서 응답으로 받을 수 있는 경우에 대한 테스트이기 때문에

  • 질문을 정상적으로 삭제할 수 있는 경우
  • 질문을 삭제할 수 없는 경우로 나눈다.

질문 삭제에 대한 조건은 단위테스트로 작성한다.

비즈니스 로직이 변경되더라도 기존 테스트 코드는 통과해야함으로 테스트 코드의 수정이 아닌 비즈니스 로직을 수정한다.

[질문 삭제 기능 구현 세부사항]// 순서

  1. 해당 질문 찾기
  2. 질문 삭제 가능 여부 판단
    2 - 1. 해당 질문의 작성자와 로그인한 사람이 일치하는지 판단
    2 - 2. 로그인한 사람과 모든 답변의 작성자가 같은지 판단
  3. 답변의 삭제 상태가 모두 삭제인지 아닌지 판단
  4. 삭제일 경우 질문도 삭제 상태로 변경

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.

1 participant