-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: [FN-78] 내 소셜 계정 목록 조회 #17
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
|
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 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. 📒 Files selected for processing (1)
WalkthroughOAuthController의 인증 URI 생성 시 사용자 ID를 하드코딩(1L)하도록 수정되었습니다. UserController에 현재 사용자의 소셜 링크를 반환하는 신규 GET 엔드포인트가 추가되었고, 관련 모델(SocialLinkResponse, SocialLinksResponse), 서비스, 레포지토리, 엔티티 필드, 테스트 코드가 함께 도입 및 확장되었습니다. AppConfig에서는 ObjectMapper 빈이 제거되었습니다. Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 설정이 적절합니다.새로운 기능에 필요한 클래스들의 임포트와
UserOAuthLinkRepositoryMock 선언이 올바르게 추가되었습니다.Also applies to: 27-27, 32-32, 38-38, 66-67
src/main/java/project/flipnote/auth/controller/OAuthController.java
Outdated
Show resolved
Hide resolved
| public static SocialLinkResponse from(UserOAuthLink link) { | ||
| return new SocialLinkResponse( | ||
| link.getProvider(), | ||
| link.getLinkedAt() | ||
| ); | ||
| } |
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.
🛠️ 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.
| 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.
📝 변경 내용
✅ 체크리스트
💬 기타 참고 사항
Summary by CodeRabbit
신규 기능
/v1/users/me/social-links)가 추가되었습니다.버그 수정
테스트