-
Notifications
You must be signed in to change notification settings - Fork 0
[FEATURE/#21] MBTI API 구현 #26
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
## 🔗 Related Issue <!-- 이슈 번호를 작성하여 종료시켜주세요 --> - Closes #18 ## 📝 Summary <!-- 작업한 기능을 설명해주세요 --> Swagger 접속을 위해 Spring Security를 설정했습니다. - build.grade에 Spring Security 의존성 추가 - Swagger 관련 주소 접속 허용 ## 🔄 Changes <!-- 구체적으로 어떤 파일/로직이 변경되었는지 체크해주세요 --> - [ ] API 변경 (추가/수정) - [ ] 데이터 및 도메인 변경 (DB, 비즈니스 로직) - [x] 설정 또는 인프라 관련 변경 - [ ] 리팩토링 ## 💬 Questions & Review Points <!-- 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 --> Swagger 접속을 위해 JWT 및 다른 기능들은 제외하고 SecurityConfig만 먼저 올립니다! 다른 기능들은 [기존 PR](https://github.com/Valuedi/Valuedi_Backend/pull/14)에서 확인해주세요! ## 📸 API Test Results (Swagger) <!-- API 테스트 스크린샷 첨부 --> <img width="1325" height="713" alt="스크린샷 2026-01-15 오후 10 27 24" src="https://github.com/user-attachments/assets/763ce258-99b4-4810-bad1-4bb4a0bf36a9" /> ## ✅ Checklist - [x] API 테스트 완료 - [x] 테스트 결과 사진 첨부 - [x] 빌드 성공 확인 (./gradlew build)
seamooll
left a comment
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.
수고하셨습니다!
커밋 메시지 작성 시에는 단순히 충돌 해결이라고 적기보다는, 어떤 충돌을 어떤 방식으로 해결했는지 조금 더 구체적으로 작성해주시면 좋을 것 같습니다. 또한 커밋 메시지 특성상 감정 표현은 제외해주시면 좋을 것 같습니다
.github/workflows/ci.yml
Outdated
| on: | ||
| pull_request: | ||
| branches: [ "main" ,"develop" ] | ||
| branches: [ "develop" ] |
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.
ci.yml 파일 수정하시면 안 됩니다! 충돌 잡을 때 꼼꼼하게 봐주세요.
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.
앗 main꺼를 처음에 머지 하면서 잘못 반영된거 같습니다...! ㅠㅠ 죄송합니다
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.
넵!
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.
스웨거에서 각 필드에 기본 예시값 들어갈 수 있게 @Schema 추가해주세요
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.
추가했습니다!!
| @Table(name = "mbti_question") | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @AllArgsConstructor |
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.
@AllArgsConstructor 쓰실 때 access = AccessLevel.PRIVATE도 설정해주세요!
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 MbtiQuestionCategory category; | ||
|
|
||
| @Lob | ||
| @Column(nullable = false) |
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.
@column에 name 속성도 빠짐없이 설정해주세요!
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.
각 도메인별 Exception 정의하실 때 워크북에 나온 방식으로 해주세요! 7주차 워크북 참고해주시면 좋을 것 같습니다. 아래 에러 코드 부분도 같이 수정해주세요
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.
수정했습니당
| MemberMbtiTest test = MemberMbtiTest.builder() | ||
| .memberId(memberId) | ||
| .resultType(score.resultType()) | ||
| .anxietyScore(score.anxietyScore()) | ||
| .stabilityScore(score.stabilityScore()) | ||
| .impulseScore(score.impulseScore()) | ||
| .planningScore(score.planningScore()) | ||
| .aggressiveScore(score.aggressiveScore()) | ||
| .conservativeScore(score.conservativeScore()) | ||
| .avoidanceScore(score.avoidanceScore()) | ||
| .rationalScore(score.rationalScore()) | ||
| .isActive(true) | ||
| .build(); |
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.
엔티티와 DTO 간 변환은 컨버터에서 하는게 가독성과 책임분리 측면에서 좋을 것 같습니다.
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.
서비스단은 Query, Command로 나눠서 작성해주세요! 트랜잭션 어노테이션은 클래스 분리 후 클래스 단에서 붙이는 게 좋을 것같습니다.
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.
넵!!
| @Transactional(readOnly = true) | ||
| public FinanceMbtiTypeInfoDto get(MbtiType type) { | ||
| MbtiTypeInfo e = mbtiTypeInfoRepository.findByType(type) | ||
| .orElseThrow(() -> new IllegalStateException("Finance MBTI type info not found: " + 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.
에러 처리하실 때 전역핸들러 사용해서 해주셔요! 7주차 워크북 참고해주시면 좋을 것 같습니다
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.
네!!
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class MemberMbtiResponse { |
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.
도메인은 BaseEntity 상속해주시고 createdAt 필드 삭제해주세요
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.
넵! MemberMbtiTest랑 MbtiQuestion도 동일하게 적용했습니당
JeongGyul
left a comment
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.
수고하셨습니다! 코멘트 확인 부탁드려요!
🔗 Related Issue
📝 Summary
Finance MBTI 테스트 제출 API
테스트 제출 시 서버 기준의 활성 문항 목록을 기준으로 검증
첫검사와 재검사를 동일한 API로 통합하여 처리
재검사 전용 엔드포인트를 추가하지 않고, 테스트 재제출 시 기존 active 결과를 비활성화(isActive=false) 하고 새 결과를 active로 저장하는 방식으로 구현
answers 데이터에 대한 예외처리를 서비스에 추가
MBTI 결과 조회
MBTI 유형 정보 조회
MBTI 유형별 질문 조회
🔄 Changes
💬 Questions & Review Points
재검사의 경우 딱히 횟수 제한이나, mbti 변경시 비교 화면이 없어서 굳이 새 엔드포인트 만들 필요는 없다고 판단해서 테스트 엔드포인트 그대로 사용합니다!!
📸 API Test Results (Swagger)
POST /api/finance-mbti/test
GET /api/finance-mbti/result
GET /api/finance-mbti/questions
GET /api/finance-mbti/result/type
✅ Checklist