Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning
|
| Cohort / File(s) | 요약 |
|---|---|
사용자 엔티티 backend/src/main/java/moadong/user/entity/User.java |
개인정보 처리 동의 여부를 저장하는 allowedPersonalInformation 필드(기본값: false)와 동의 상태를 변경하는 allowPersonalInformation() 메서드 추가 |
API 엔드포인트 backend/src/main/java/moadong/user/controller/UserController.java |
PUT /auth/user/allow/personal-information 엔드포인트 추가로 인증된 사용자가 개인정보 처리 동의를 설정할 수 있도록 구현 |
응답 페이로드 backend/src/main/java/moadong/user/payload/response/LoginResponse.java |
로그인 응답에 allowedPersonalInformation 필드 추가 |
서비스 계층 backend/src/main/java/moadong/user/service/UserCommandService.java |
allowPersonalInformation(String userId) 메서드 추가 및 loginUser() 메서드에서 로그인 응답에 동의 여부 포함하도록 수정 |
예상 코드 리뷰 난이도
🎯 2 (Simple) | ⏱️ ~10 minutes
제안 라벨
📬 API
제안 리뷰어
- Zepelown
- PororoAndFriends
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | PR 제목은 개인정보 활용 동의 API 추가라는 주요 변경사항을 명확하게 요약하고 있으며, 간결하고 구체적입니다. |
| Linked Issues check | ✅ Passed | PR의 모든 코드 변경사항이 MOA-619의 요구사항(개인정보 필드 추가, 개인정보 동의 API 추가)을 충족합니다. |
| Out of Scope Changes check | ✅ Passed | 모든 변경사항이 링크된 이슈(MOA-619)의 요구사항과 직접적으로 관련되어 있으며 범위를 벗어난 변경이 없습니다. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
feature/#1159-add-allow-personal-info-MOA-619
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Test Results72 tests 72 ✅ 15s ⏱️ Results for commit e324d19. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/src/main/java/moadong/user/service/UserCommandService.java (1)
7-7:⚠️ Potential issue | 🟠 Major
jakarta.transaction.Transactional대신org.springframework.transaction.annotation.Transactional으로 변경하세요.이 프로젝트는
MongoTransactionManager를 사용하여 Spring Data MongoDB 트랜잭션을 관리합니다. JTA의jakarta.transaction.Transactional은 MongoDB 트랜잭션과 통합되지 않으며, Spring의org.springframework.transaction.annotation.Transactional을 사용해야 합니다.이 파일 외에도
FcmTxService.java와ClubApplyServiceV1.java에서도 동일한 import를 사용하고 있으므로 함께 수정하는 것을 권장합니다.변경사항
-import jakarta.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional;
🧹 Nitpick comments (2)
backend/src/main/java/moadong/user/entity/User.java (1)
139-141: 동의 철회(revoke) 기능이 누락되어 있습니다.
allowPersonalInformation()은true로만 설정할 수 있고, 다시false로 되돌리는 방법이 없습니다. 개인정보 보호법(GDPR, 개인정보보호법 등)에 따르면 사용자는 언제든지 동의를 철회할 수 있어야 합니다.동의 철회 메서드를 추가하거나, 토글 방식으로 변경하는 것을 권장합니다.
♻️ 제안: 토글 방식 또는 철회 메서드 추가
public void allowPersonalInformation() { this.allowedPersonalInformation = true; } + + public void revokePersonalInformation() { + this.allowedPersonalInformation = false; + }backend/src/main/java/moadong/user/service/UserCommandService.java (1)
181-187:allowPersonalInformation메서드에서 이미 동의한 사용자에 대한 처리가 없습니다.이미
allowedPersonalInformation이true인 사용자가 다시 호출해도 동일하게true로 설정하고 저장합니다. 기능적으로 문제는 없지만(멱등성), 불필요한 DB write를 방지하려면 early return을 고려해볼 수 있습니다.♻️ 선택적 개선안
`@Transactional` public void allowPersonalInformation(String userId) { User user = userRepository.findUserByUserId(userId) .orElseThrow(() -> new RestApiException(ErrorCode.USER_NOT_EXIST)); + if (Boolean.TRUE.equals(user.getAllowedPersonalInformation())) { + return; + } user.allowPersonalInformation(); userRepository.save(user); }
| @PutMapping("/allow/personal-information") | ||
| @Operation(summary = "개인정보 활용 동의", description = "개인정보 활용 동의를 합니다.") | ||
| @PreAuthorize("isAuthenticated()") |
|
|
||
| @Transactional | ||
| public void allowPersonalInformation(String userId) { | ||
| User user = userRepository.findUserByUserId(userId) | ||
| .orElseThrow(() -> new RestApiException(ErrorCode.USER_NOT_EXIST)); | ||
| user.allowPersonalInformation(); | ||
| userRepository.save(user); | ||
| } |
There was a problem hiding this comment.
코드 보면서 AI와 함께 리뷰해봤는데, 트랜잭션 내에서 조회한 영속 엔티티라면 save 없이도 변경 사항이 반영될 수 있다고 하네요
한 번 확인해보시면 좋을 것 같아요.
크게 문제 되는 부분은 아닌 것 같습니다1
There was a problem hiding this comment.
맞워요 더티 체킹 되긴하지만 명시적으로 표시하는게 햇갈리지도않구요~
#️⃣연관된 이슈
#1159
📝작업 내용
allowedPersonalInformation필드 추가PUT /allow/personal-information)중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
새로운 기능