Skip to content

Conversation

@dungbik
Copy link
Contributor

@dungbik dungbik commented Jul 26, 2025

📝 변경 내용


✅ 체크리스트

  • 코드가 정상적으로 동작함
  • 테스트 코드 통과함
  • 문서(README 등)를 최신화함
  • 코드 스타일 가이드 준수

💬 기타 참고 사항

Summary by CodeRabbit

  • 신규 기능

    • 사용자의 소셜 계정 연동 목록을 조회하는 새로운 API 엔드포인트(/v1/users/me/social-links)가 추가되었습니다.
    • 소셜 계정 연동 시 연동 일시가 자동으로 기록됩니다.
  • 버그 수정

    • 불필요한 설정이 제거되어 서비스 안정성이 향상되었습니다.
  • 테스트

    • 소셜 계정 연동 목록 조회 기능에 대한 테스트가 추가되었습니다.

@dungbik dungbik requested a review from stoneTiger0912 July 26, 2025 10:55
@dungbik dungbik self-assigned this Jul 26, 2025
@dungbik dungbik added the enhancement New feature or request label Jul 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 26, 2025

Warning

Rate limit exceeded

@dungbik has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 97004b8 and 2bbeaa6.

📒 Files selected for processing (1)
  • src/test/java/project/flipnote/user/service/UserServiceTest.java (4 hunks)

Walkthrough

OAuthController의 인증 URI 생성 시 사용자 ID를 하드코딩(1L)하도록 수정되었습니다. UserController에 현재 사용자의 소셜 링크를 반환하는 신규 GET 엔드포인트가 추가되었고, 관련 모델(SocialLinkResponse, SocialLinksResponse), 서비스, 레포지토리, 엔티티 필드, 테스트 코드가 함께 도입 및 확장되었습니다. AppConfig에서는 ObjectMapper 빈이 제거되었습니다.

Changes

파일/경로 요약 변경 내용 요약
OAuthController.java 인증 URI 생성 시 userId를 동적으로 가져오지 않고 1L로 하드코딩
AppConfig.java ObjectMapper 빈 및 관련 import 제거, restClient 빈만 유지
UserController.java /v1/users/me/social-links GET 엔드포인트 추가, 인증 사용자 소셜 링크 반환
UserOAuthLink.java linkedAt(생성일시) 필드 및 자동 감사(EntityListeners) 추가
SocialLinkResponse.java, SocialLinksResponse.java 소셜 링크 응답용 record 2종 신규 도입, 엔티티→DTO 변환 정적 팩토리 메서드 포함
UserOAuthLinkRepository.java 사용자 ID로 소셜 링크 목록 조회 메서드(findByUser_Id) 추가
UserService.java 사용자 소셜 링크 조회 메서드(getSocialLinks) 및 레포지토리 의존성 추가
UserServiceTest.java 소셜 링크 조회 기능 테스트(GetSocialLinks nested class, success 메서드) 추가, 불필요한 mock 제거

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UserController
    participant UserService
    participant UserOAuthLinkRepository

    Client->>UserController: GET /v1/users/me/social-links (with UserAuth)
    UserController->>UserService: getSocialLinks(userAuth.userId())
    UserService->>UserOAuthLinkRepository: findByUser_Id(userId)
    UserOAuthLinkRepository-->>UserService: List<UserOAuthLink>
    UserService-->>UserController: SocialLinksResponse
    UserController-->>Client: 200 OK + SocialLinksResponse
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Possibly related PRs

  • Feat: [FN-76][FN-77] 소셜 연동 #16: OAuthController 및 OAuthService의 소셜 로그인 플로우 전체 도입 PR로, 이번 PR의 OAuthController 하드코딩 변경과 직접적으로 연관됨.

Suggested reviewers

  • stoneTiger0912

Poem

🐰
소셜 링크를 찾아 hop hop hop,
새 record와 엔드포인트가 똑똑!
linkedAt 필드가 시간을 기억하고
테스트도 꼼꼼히 챙겼지요.
FlipNote의 봄, 코드가 춤추는 밤!
🌱✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/get-my-social-links

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98310c3 and 97004b8.

📒 Files selected for processing (9)
  • src/main/java/project/flipnote/auth/controller/OAuthController.java (1 hunks)
  • src/main/java/project/flipnote/common/config/AppConfig.java (0 hunks)
  • src/main/java/project/flipnote/user/controller/UserController.java (2 hunks)
  • src/main/java/project/flipnote/user/entity/UserOAuthLink.java (3 hunks)
  • src/main/java/project/flipnote/user/model/SocialLinkResponse.java (1 hunks)
  • src/main/java/project/flipnote/user/model/SocialLinksResponse.java (1 hunks)
  • src/main/java/project/flipnote/user/repository/UserOAuthLinkRepository.java (1 hunks)
  • src/main/java/project/flipnote/user/service/UserService.java (3 hunks)
  • src/test/java/project/flipnote/user/service/UserServiceTest.java (4 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/project/flipnote/common/config/AppConfig.java
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/main/java/project/flipnote/user/entity/UserOAuthLink.java (4)
src/main/java/project/flipnote/common/entity/BaseEntity.java (1)
  • BaseEntity (14-26)
src/main/java/project/flipnote/user/entity/User.java (2)
  • User (20-105)
  • increaseTokenVersion (91-93)
src/main/java/project/flipnote/common/config/AuditingConfig.java (1)
  • AuditingConfig (6-10)
src/main/java/project/flipnote/common/entity/SoftDeletableEntity.java (1)
  • SoftDeletableEntity (8-21)
src/main/java/project/flipnote/auth/controller/OAuthController.java (1)
src/main/java/project/flipnote/auth/service/OAuthService.java (1)
  • OAuthService (27-92)
🔇 Additional comments (11)
src/main/java/project/flipnote/user/service/UserService.java (2)

3-3: 새로운 의존성 추가가 적절합니다.

소셜 링크 조회 기능을 위한 필요한 import들과 UserOAuthLinkRepository 의존성이 올바르게 추가되었습니다.

Also applies to: 16-16, 21-21, 27-27, 40-40


111-115: 소셜 링크 조회 메서드 구현이 올바릅니다.

메서드 구현이 간결하고 명확합니다. 레포지토리에서 데이터를 조회하고 응답 모델로 변환하는 로직이 기존 서비스 패턴과 일치합니다.

src/main/java/project/flipnote/user/controller/UserController.java (2)

21-21: 응답 모델 import가 적절합니다.

새로운 소셜 링크 응답 모델의 import가 올바르게 추가되었습니다.


82-89: 소셜 링크 조회 엔드포인트 구현이 우수합니다.

RESTful 패턴을 따르는 엔드포인트 설계가 좋습니다. 인증된 사용자의 ID를 올바르게 사용하고 기존 컨트롤러 패턴과 일치합니다.

src/main/java/project/flipnote/user/repository/UserOAuthLinkRepository.java (2)

3-3: List import 추가가 적절합니다.

새로운 메서드의 반환 타입을 위한 List import가 올바르게 추가되었습니다.


13-13: 레포지토리 메서드 추가가 올바릅니다.

Spring Data JPA 네이밍 규칙을 따르는 findByUser_Id 메서드가 적절하게 추가되었습니다. 기존의 existsByUser_IdAndProviderId 메서드와 일관성을 유지합니다.

src/main/java/project/flipnote/user/model/SocialLinksResponse.java (1)

1-18: 소셜 링크 응답 모델 구현이 우수합니다.

Record 클래스 사용과 정적 팩토리 메서드 패턴이 적절합니다. Stream API를 사용한 변환 로직이 명확하고 현대적인 Java 패턴을 잘 따르고 있습니다.

src/main/java/project/flipnote/user/entity/UserOAuthLink.java (2)

28-28: JPA 감사 기능이 올바르게 설정되었습니다.

@EntityListeners(AuditingEntityListener.class) 어노테이션이 적절히 추가되어 엔티티의 생성 시점을 자동으로 추적할 수 있습니다.


52-54: linkedAt 필드 구현이 적절합니다.

@CreatedDate@Column(updatable = false) 조합으로 소셜 계정 연결 시점을 정확히 기록하고 수정을 방지합니다.

src/main/java/project/flipnote/user/model/SocialLinkResponse.java (1)

9-15: Record 구조와 JSON 포맷팅이 적절합니다.

불변 응답 객체로 record를 사용하고, @JsonFormat으로 일관된 날짜 형식을 제공하는 것이 좋습니다.

src/test/java/project/flipnote/user/service/UserServiceTest.java (1)

7-7: 임포트와 Mock 설정이 적절합니다.

새로운 기능에 필요한 클래스들의 임포트와 UserOAuthLinkRepository Mock 선언이 올바르게 추가되었습니다.

Also applies to: 27-27, 32-32, 38-38, 66-67

Comment on lines +17 to +22
public static SocialLinkResponse from(UserOAuthLink link) {
return new SocialLinkResponse(
link.getProvider(),
link.getLinkedAt()
);
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

팩토리 메서드에 null 안전성을 개선하세요.

link 파라미터와 link.getLinkedAt() 값에 대한 null 체크가 없어 런타임에 NullPointerException이 발생할 수 있습니다.

 public static SocialLinkResponse from(UserOAuthLink link) {
+    if (link == null) {
+        throw new IllegalArgumentException("UserOAuthLink cannot be null");
+    }
     return new SocialLinkResponse(
         link.getProvider(),
         link.getLinkedAt()
     );
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static SocialLinkResponse from(UserOAuthLink link) {
return new SocialLinkResponse(
link.getProvider(),
link.getLinkedAt()
);
}
public static SocialLinkResponse from(UserOAuthLink link) {
if (link == null) {
throw new IllegalArgumentException("UserOAuthLink cannot be null");
}
return new SocialLinkResponse(
link.getProvider(),
link.getLinkedAt()
);
}
🤖 Prompt for AI Agents
In src/main/java/project/flipnote/user/model/SocialLinkResponse.java around
lines 17 to 22, the from() factory method lacks null safety checks for the link
parameter and its getLinkedAt() value, which can cause NullPointerException at
runtime. Add null checks to verify that link is not null before accessing its
methods, and also check if link.getLinkedAt() is null before passing it to the
constructor, handling these cases appropriately to prevent exceptions.

@dungbik dungbik merged commit 7f420ae into develop Jul 26, 2025
3 checks passed
@dungbik dungbik deleted the feat/get-my-social-links branch July 26, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants