Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
Summary by CodeRabbit릴리스 노트
Walkthrough테스트 사용자를 나타내는 하드코딩된 로직을 제거하고, 새로운 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MemberService
participant AdminRepository
participant Database
Client->>MemberService: findMember(memberId)
MemberService->>MemberService: 프로필 정보 조회
alt Dev/Prod 프로필
MemberService->>MemberService: 하드코딩된 ID로 isAdmin 결정
else 기타 프로필
MemberService->>AdminRepository: existsByMemberId(memberId)
AdminRepository->>Database: SELECT COUNT(*) FROM admin WHERE member_id = ?
Database-->>AdminRepository: 조회 결과
AdminRepository-->>MemberService: isAdmin (boolean)
end
MemberService->>MemberService: MyProfileResponse 생성 (isAdmin 포함)
MemberService-->>Client: MyProfileResponse 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 기존의 하드코딩된 '테스트 사용자' 개념을 데이터베이스 기반의 '관리자' 역할로 전환하여 사용자 관리의 유연성과 확장성을 향상시킵니다. 새로운 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. 관리자 권한, 데이터베이스에 담아, 새로운 시작. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces an Admin entity and repository to manage administrative privileges, replacing the previous isTestUser logic. Changes include a new database migration, updates to the MemberService to check for admin status, and renaming fields in the MyProfileResponse DTO and associated tests. Feedback focuses on improving the isAdmin implementation by removing hardcoded member IDs in favor of the database-driven approach and optimizing performance by changing the fetch strategy of the Member relationship in the Admin entity from EAGER to LAZY.
| private boolean isAdmin(Long memberId) { | ||
| if ("dev".equals(activeProfile)) { | ||
| return memberId.equals(34L); | ||
| } else if ("prod".equals(activeProfile)) { | ||
| return memberId.equals(302L); | ||
| } | ||
| return false; | ||
| return adminRepository.existsByMemberId(memberId); | ||
| } |
There was a problem hiding this comment.
dev 및 prod 환경에서 특정 memberId를 하드코딩하여 어드민 여부를 확인하고 있습니다. 이러한 방식은 유지보수가 어렵고, 새로 도입된 Admin 테이블의 데이터를 무시하게 됩니다. 예를 들어, dev 환경에서는 34번 사용자 외에 Admin 테이블에 등록된 다른 사용자가 어드민으로 인식되지 않습니다. 모든 환경에서 AdminRepository를 통해 일관되게 어드민 여부를 관리하도록 변경하는 것이 바람직합니다.
private boolean isAdmin(Long memberId) {
return adminRepository.existsByMemberId(memberId);
}| @Id | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.EAGER) |
There was a problem hiding this comment.
@manytoone 관계의 기본 페치 전략은 EAGER입니다. 이는 불필요한 엔티티 로딩과 조인을 유발하여 성능 저하의 원인이 될 수 있으므로, 명시적으로 LAZY 전략을 사용하는 것을 권장합니다.
| @ManyToOne(fetch = FetchType.EAGER) | |
| @ManyToOne(fetch = FetchType.LAZY) |
closed #
작업 내용
스크린샷
참고 사항