Skip to content

[feature] 개인정보 활용 동의 API 추가#1160

Merged
lepitaaar merged 2 commits intodevelop/befrom
feature/#1159-add-allow-personal-info-MOA-619
Feb 8, 2026
Merged

[feature] 개인정보 활용 동의 API 추가#1160
lepitaaar merged 2 commits intodevelop/befrom
feature/#1159-add-allow-personal-info-MOA-619

Conversation

@lepitaaar
Copy link
Contributor

@lepitaaar lepitaaar commented Feb 8, 2026

#️⃣연관된 이슈

#1159

📝작업 내용

  • [User] 엔티티에 allowedPersonalInformation 필드 추가
  • 로그인 시 개인정보 동의 여부를 응답에 포함
  • 개인정보 활용 동의 API 추가 (PUT /allow/personal-information)

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

새로운 기능

  • 개인 정보 이용 동의 기능 추가
    • 인증된 사용자가 개인 정보 이용을 허용하는 API 엔드포인트 추가
    • 로그인 응답에 개인 정보 동의 상태 포함

@lepitaaar lepitaaar self-assigned this Feb 8, 2026
@lepitaaar lepitaaar added ✨ Feature 기능 개발 💾 BE Backend labels Feb 8, 2026
@vercel
Copy link

vercel bot commented Feb 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moadong Ready Ready Preview, Comment Feb 8, 2026 7:48am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

워크스루

개인정보 처리 동의 기능을 추가하기 위해 사용자 컨트롤러에 새로운 API 엔드포인트를 도입하고, 사용자 엔티티에 동의 여부를 저장하는 필드와 메서드를 추가했으며, 로그인 응답 페이로드를 업데이트했습니다.

변경 사항

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 ⚠️ Warning 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Test Results

72 tests   72 ✅  15s ⏱️
14 suites   0 💤
14 files     0 ❌

Results for commit e324d19.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.javaClubApplyServiceV1.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 메서드에서 이미 동의한 사용자에 대한 처리가 없습니다.

이미 allowedPersonalInformationtrue인 사용자가 다시 호출해도 동일하게 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);
     }

Copy link
Member

@oesnuj oesnuj left a comment

Choose a reason for hiding this comment

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

빠른 개발 고생하셨슴니다

Comment on lines +119 to +121
@PutMapping("/allow/personal-information")
@Operation(summary = "개인정보 활용 동의", description = "개인정보 활용 동의를 합니다.")
@PreAuthorize("isAuthenticated()")
Copy link
Member

Choose a reason for hiding this comment

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

인증도 잘 챙겨서 해줬네요
Swagger도 👍👍

Comment on lines 180 to +187

@Transactional
public void allowPersonalInformation(String userId) {
User user = userRepository.findUserByUserId(userId)
.orElseThrow(() -> new RestApiException(ErrorCode.USER_NOT_EXIST));
user.allowPersonalInformation();
userRepository.save(user);
}
Copy link
Member

Choose a reason for hiding this comment

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

코드 보면서 AI와 함께 리뷰해봤는데, 트랜잭션 내에서 조회한 영속 엔티티라면 save 없이도 변경 사항이 반영될 수 있다고 하네요
한 번 확인해보시면 좋을 것 같아요.
크게 문제 되는 부분은 아닌 것 같습니다1

Copy link
Member

Choose a reason for hiding this comment

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

명시적으로 save를 두는게 좋아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

맞워요 더티 체킹 되긴하지만 명시적으로 표시하는게 햇갈리지도않구요~

@lepitaaar lepitaaar merged commit a51f451 into develop/be Feb 8, 2026
5 checks passed
@lepitaaar lepitaaar deleted the feature/#1159-add-allow-personal-info-MOA-619 branch February 21, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💾 BE Backend ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants