-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 인터뷰 기능을 구현한다 #75
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
Conversation
- 인터뷰 타입 등록 - 인터뷰 타입 조회 예외 처리 등록 - 인터뷰 타입 테스트 코드 작성
- memberinterview, interview 패키지 분리를 위해 기존 생성 파일 패키지 분리
- 인터뷰 모델 코드 정의 - 인터뷰 도메인 리포지터리 및 구현체 정의
- 인터뷰 등록 기능 개발 - 같은 질문 등록 불가능하도록 설정 - 컨트롤러, 서비스 연결
- 인터뷰 Fixture 리포지터리 작성 - 인터뷰 service, infrastructure 테스트 작성 - 인터뷰 fixture 등록
- 인터뷰 수정 기능 구현 - 관련 테스트 코드 작성 - 예외처리 추가
- 회원 인터뷰 응시 기능 구현 - 필요한 도메인 코드 기본 작성 - 필요한 서비스, 리포지터리 코드 기본 작성
- 인터뷰 타입 조회 기능 초안 구현 - 관련 QueryService, QueryRepository 구현
- 회원 인터뷰 목록 조회 기능 구현 - 관련 QueryRepository 테스트 작성 - 응시한 인터뷰는 true, 응시하지 않은 인터뷰는 false로 나오도록 구현
- MemberInterviewResponse 이름을 MemberInterviewSimpleResponse로 변경 - 패키지 역참조 수정하여 infrastructure에 들어가도록 수정
- 회원 인터뷰 상세 조회 기능 구현 - 응시한 인터뷰면 답변 나오고 응시하지 않은 인터뷰면 공백 나오도록 설정
- 회원 인터뷰 수정 기능 구현 - JPA만으로 구현하도록 설정
- 인터뷰 등록 인자 가독성 고려하여 위치 수정
- 인터뷰 단위테스트 추가 - 비교 판정 테스트 작성 - 필요한 fixture 등록
- 회원 인터뷰 단위테스트 추가
- 회원 인터뷰 목록 단위테스트 추가 - 필요없는 MemberInterviews 메서드 제거 - MemberInterview equals&hashcode 재정의
- InterviewFixture에 id가 고정으로 들어가던 문제 수정
- InterviewQueryService 테스트 작성 - 필요한 fixture 등록 - extracting을 이용하여 더 세밀하게 검증하도록 작성
- InterviewQueryRepository 테스트 작성 - InterviewResponse의 type 타입 변경
- InterviewController 통합 테스트 작성 - 인터뷰 문서화 작성
- InterviewController 인수 테스트 작성 - 필요한 fixture 등록
- MemberInterviewsService 테스트 작성 - 필요한 fake repository 작성 - 빌더 패턴 추가
- MemberInterviewsQueryService 테스트 작성 - MemberInterviewsFakeRepository 로직 수정
- MemberInterviewsQueryRepository 추가된 메서드 테스트 - MemberInterviewsQueryRepository 쿼리 수정
- MemberInterviewsJpaRepository 테스트 작성
- MemberInterviewsController 통합 테스트 작성 및 컨트롤러 이름 변경 - 문서화 작성
- interview.adoc 문서 보완
- Transactional 제거 및 save 전 미리 작업하도록 수정
- 테스트에 사용하는 fixture 패키지 분리
- MemberInterviewsController 인수 테스트 작성 - 필요한 fixture 등록 - 수정 API에서의 문제 보류
- MemberAuthConfig에 interview 관련 url 추가
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다.
테스트에서 전반적으로 중복되는 로직이 많아 보입니다. 이 부분 리팩터링을 좀 해야할 것 같네요
리뷰 확인해주시고 수정부탁드려요~
private final InterviewRepository interviewRepository; | ||
private final MemberInterviewsRepository memberInterviewsRepository; | ||
|
||
public void submitInterview(final Long interviewId, final Long memberId, final MemberInterviewSubmitRequest request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
매개변수 3개 이상일 시 줄바꿈 추가해주세요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
갯수를 파악하지 못하고 길이로만 생각했던 것 같습니다. 나머지 부분들도 모두 반영하였습니다 :)
return memberInterviewsRepository.save(memberInterviews); | ||
} | ||
|
||
public MemberInterview updateMemberInterviewAnswer(final Long interviewId, final Long memberId, final MemberInterviewUpdateRequest request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 줄바꿈 추가해주세요
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 컬럼에 대한 제약조건이 없어도 되나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 id에 대한 제약조건을 말씀하시는 걸까요? id에 대해 제약조건이 있을 필요가 있는지 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 아닙니다 memberId 컬럼에 대해 말씀드린겁니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memberId에 대해 제약조건 추가하였습니다. (nullable false, unique true) 알려주셔서 감사합니다!
|
||
@GetMapping | ||
public ResponseEntity<InterviewsResponse> findInterviewsByType( | ||
@RequestParam(value = "type", defaultValue = "나") final String type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수처리 해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InterviewController랑 MemberInterviewsController 모두 상수 처리 완료했습니다
interviewRepository.save(인터뷰_타입_질문(InterviewType.ME, "내가 생각하는 내 장점과 단점은 이거다!")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.ME, "내가 생각하는 나의 반전 매력은 이거야!")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.ME, "10년 뒤 멋진 내 모습, 과연 어떤 모습일까?")); | ||
|
||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "관계 관련 질문 1")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "관계 관련 질문 2")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "관계 관련 질문 3")); | ||
|
||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "연인 관련 질문 1")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "연인 관련 질문 2")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "연인 관련 질문 3")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
save메서드를 자주 사용한 거 같은데 메서드로 분리하거나 fixture를 두고 사용하는게 좋아보입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드 분리로 적용하였습니다 :)
interviewQueryService = new InterviewQueryService(interviewRepository); | ||
} | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
똑같은 기능에 대한 테스트면 @nested를 사용하는 건 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기능이 한 가지밖에 없어서 nested를 사용하지 않았었는데, 기능이 더 추가될 수 있기 때문에 미리 nested를 붙여놓는 게 좋다고 생각이 들었습니다. 말씀하신 대로 nested 적용하였습니다 :)
interviewRepository.save(인터뷰_타입_질문(InterviewType.ME, "일상에서 느끼는 나의 소소한 행복")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "남사친/여사친에 대한 나의 생각")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "나의 인간관계 스타일")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.RELATIONSHIP, "호감을 느끼는 사람의 유형/타입")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "추구하는 만남 횟수와 연락 빈도")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "내가 연인을 사랑하는 방식")); | ||
interviewRepository.save(인터뷰_타입_질문(InterviewType.COUPLE, "연인에게 바라는 점")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분도 중복 로직을 따로 분리하는게 좋을 거 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드 분리 적용하였습니다 :)
.build(); | ||
} | ||
|
||
public static Interview 인터뷰_타입_질문_id(final InterviewType type, final String question, final Long id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
매개변수 3개 이상일 시 줄바꿈하고 작성해주세요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
같은 리뷰 발생하지 않도록 하겠습니다!
- 인자 3개 이상 시 줄바꿈 추가되도록 수정
- 컨트롤러 인자 3개 이상 시 줄바꿈되도록 수정 - 괄호 위치 수정
- InterviewQueryServiceTest에 Nested 추가
- 반복적으로 인터뷰를 넣었던 코드를 saveOtherInterviews 메서드로 재사용
- 인터뷰 답변 수정 인수 테스트 수정 - 인터뷰 응시 과정 추가
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 아닙니다 memberId 컬럼에 대해 말씀드린겁니다
- memberId 제약조건 추가
📄 Summary
인터뷰 기능을 구현했습니다.
🙋🏻 More
MemberInterviewsControllerAcceptanceTest
에서 인터뷰 수정 테스트를 하던 중 response.as로 변환하는 부분이 계속 오류가 발생해서, 이 부분은 일단 주석처리했습니다. 원인은 text/plain으로 응답이 나와 json으로 매핑할 수 없는 것 같아 보이는데, 더 알아봐야 할 듯 합니다. 일단 이 부분 제외하고 리뷰 먼저 해주시는 게 좋을 것 같습니다.close #51