Skip to content
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

πŸ„ :: (Meogo-3) user #4

Merged
merged 4 commits into from
Sep 2, 2024
Merged

πŸ„ :: (Meogo-3) user #4

merged 4 commits into from
Sep 2, 2024

Conversation

meltapplee
Copy link
Member

@meltapplee meltapplee commented Sep 2, 2024

close #3

Summary by CodeRabbit

  • μƒˆλ‘œμš΄ κΈ°λŠ₯

    • μ‚¬μš©μž 관리 κΈ°λŠ₯을 μœ„ν•œ User 클래슀 및 UserRole μ—΄κ±°ν˜• μΆ”κ°€.
    • μ‚¬μš©μž 검색 및 관리 κΈ°λŠ₯을 μ œκ³΅ν•˜λŠ” UserFacade 클래슀 λ„μž….
    • μ‚¬μš©μž κ΄€λ ¨ 데이터 μž‘μ—…μ„ μœ„ν•œ UserRepository μΈν„°νŽ˜μ΄μŠ€ μΆ”κ°€.
    • μ‚¬μš©μž 검색 μ‹€νŒ¨ μ‹œ λ°œμƒν•˜λŠ” UserNotFoundException μ˜ˆμ™Έ μΆ”κ°€.
    • μ‚¬μš©μž μ°ΎκΈ° μ‹€νŒ¨ μ‹œ μ‚¬μš©ν•  수 μžˆλŠ” USER_NOT_FOUND 였λ₯˜ μ½”λ“œ μΆ”κ°€.
  • 버그 μˆ˜μ •

    • μ‚¬μš©μž 검색 μ‹œ λ°œμƒν•  수 μžˆλŠ” 였λ₯˜ 처리 κ°œμ„ .
  • λ¬Έμ„œν™”

    • μ‚¬μš©μž κ΄€λ ¨ 클래슀 및 μ˜ˆμ™Έμ— λŒ€ν•œ μ„€λͺ… μΆ”κ°€.

@meltapplee meltapplee added the core label Sep 2, 2024
@meltapplee meltapplee self-assigned this Sep 2, 2024
Copy link

coderabbitai bot commented Sep 2, 2024

Warning

Rate limit exceeded

@meltapplee has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 10 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

Files that changed from the base of the PR and between 5b2b8e5 and 2d623fe.

Walkthrough

μƒˆλ‘œμš΄ μ‚¬μš©μž 관리 κΈ°λŠ₯이 λ„μž…λ˜μ–΄ User, UserRole, UserNotFoundException, UserFacade, UserRepository ν΄λž˜μŠ€κ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž μ—”ν‹°ν‹°λ₯Ό μ •μ˜ν•˜κ³ , μ‚¬μš©μž 역할을 κ΄€λ¦¬ν•˜λ©°, μ‚¬μš©μž 검색 μ‹œ μ˜ˆμ™Έ 처리λ₯Ό κ°•ν™”ν•©λ‹ˆλ‹€. λ˜ν•œ, JWT 토큰 처리 κΈ°λŠ₯의 가독성이 κ°œμ„ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
src/main/kotlin/org/meogo/domain/user/... User, UserRole, UserNotFoundException, UserFacade, UserRepository 클래슀 및 μΈν„°νŽ˜μ΄μŠ€ μΆ”κ°€.
src/main/kotlin/org/meogo/global/error/... ErrorCode μ—΄κ±°ν˜•μ— USER_NOT_FOUND μƒμˆ˜ μΆ”κ°€.
src/main/kotlin/org/meogo/global/jwt/... JwtTokenProvider 클래슀의 가독성을 κ°œμ„ ν•˜κΈ° μœ„ν•œ λ¦¬νŒ©ν† λ§.

Sequence Diagram(s)

sequenceDiagram
    participant UserFacade
    participant UserRepository
    participant UserNotFoundException

    UserFacade->>UserRepository: getUserByAccountId(accountId)
    alt User found
        UserRepository-->>UserFacade: return User
    else User not found
        UserRepository-->>UserFacade: return null
        UserFacade->>UserNotFoundException: throw UserNotFoundException
    end
Loading

Poem

🐰
μƒˆλ‘œμš΄ μ‚¬μš©μž, λ°˜μ§μ΄λŠ” 꿈,
μ—­ν• κ³Ό μ˜ˆμ™Έκ°€ ν•¨κ»˜ μΆ€.
κ΄€λ¦¬μ˜ κΈΈ, μ΄μ œλŠ” μ‰¬μ›Œ,
Rabbit도 기뻐, ν•¨κ»˜ λ›°μ–΄!
πŸ‡βœ¨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 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.
Early access features: disabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

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: 1

Outside diff range, codebase verification and nitpick comments (1)
src/main/kotlin/org/meogo/domain/user/domain/User.kt (1)

11-29: User μ—”ν‹°ν‹° 클래슀λ₯Ό κ°œμ„ ν•˜μ„Έμš”.

User μ—”ν‹°ν‹° ν΄λž˜μŠ€λŠ” 잘 κ΅¬μ‘°ν™”λ˜μ–΄ 있고 λͺ¨λ²” 사둀λ₯Ό λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ λͺ‡ 가지 κ°œμ„ ν•  μ˜μ—­μ΄ μžˆμŠ΅λ‹ˆλ‹€:

  • password 속성은 일반 ν…μŠ€νŠΈλ‘œ μ €μž₯ν•˜λ©΄ μ•ˆ λ©λ‹ˆλ‹€. μ €μž₯ν•˜κΈ° 전에 ν•΄μ‹œν•΄μ•Ό ν•©λ‹ˆλ‹€.
  • enrolledSchool 속성은 기본값이 0인 non-nullable둜 λ§Œλ“€ 수 μžˆμŠ΅λ‹ˆλ‹€.
  • profile 속성은 기본값이 빈 λ¬Έμžμ—΄μΈ non-nullable둜 λ§Œλ“€ 수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ diffλ₯Ό μ μš©ν•˜μ—¬ μ œμ•ˆλœ κ°œμ„  사항을 κ΅¬ν˜„ν•˜μ„Έμš”:

-    val password: String,
+    val password: String, // TODO: Hash the password before storing it.

-    @Column(name = "enrolled_school", nullable = true)
-    val enrolledSchool: Int? = 0,
+    @Column(name = "enrolled_school", nullable = false)
+    val enrolledSchool: Int = 0,

-    val profile: String? = null,
+    val profile: String = "",
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff91f15 and 74fb48d.

Files selected for processing (6)
  • src/main/kotlin/org/meogo/domain/user/domain/User.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/domain/UserRole.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/exception/UserNotFoundException.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/repository/UserRepository.kt (1 hunks)
  • src/main/kotlin/org/meogo/global/error/exception/ErrorCode.kt (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/kotlin/org/meogo/domain/user/domain/UserRole.kt
Additional comments not posted (6)
src/main/kotlin/org/meogo/domain/user/exception/UserNotFoundException.kt (1)

1-8: μ½”λ“œ λ³€κ²½ 사항이 μŠΉμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!

이 νŒŒμΌμ€ Kotlin κ·œμΉ™κ³Ό λͺ¨λ²” 사둀λ₯Ό 잘 λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€:

  • νŒ¨ν‚€μ§€ ꡬ쑰가 잘 μ •λ¦¬λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
  • κ΄€λ ¨ importκ°€ ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
  • μ˜ˆμ™Έ 클래슀 이름이 μ„€λͺ…μ μž…λ‹ˆλ‹€.
  • 싱글톀을 μœ„ν•΄ objectλ₯Ό μ‚¬μš©ν•˜λŠ” 것은 쒋은 μ„ νƒμž…λ‹ˆλ‹€.
  • MeogoException을 ν™•μž₯ν•˜λ©΄ μΌκ΄€λœ 였λ₯˜ μ²˜λ¦¬κ°€ κ°€λŠ₯ν•©λ‹ˆλ‹€.
  • 미리 μ •μ˜λœ 였λ₯˜ μ½”λ“œλ₯Ό μ‚¬μš©ν•˜λ©΄ μ½”λ“œ μž¬μ‚¬μš©μ„±κ³Ό μœ μ§€ 관리성이 ν–₯μƒλ©λ‹ˆλ‹€.
src/main/kotlin/org/meogo/global/error/exception/ErrorCode.kt (1)

10-11: μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

μƒˆλ‘œμš΄ μ—λŸ¬ μ½”λ“œ USER_NOT_FOUNDλ₯Ό μΆ”κ°€ν•œ 것은 μ‚¬μš©μžλ₯Ό 찾을 수 μ—†λŠ” μ‹œλ‚˜λ¦¬μ˜€μ— λŒ€ν•œ μ—λŸ¬ 처리 세뢄성을 ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€. μ—λŸ¬ μ½”λ“œλŠ” κΈ°μ‘΄ νŒ¨ν„΄μ„ λ”°λ₯΄κ³  μ˜¬λ°”λ₯΄κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

src/main/kotlin/org/meogo/domain/user/repository/UserRepository.kt (3)

8-8: μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

save λ©”μ„œλ“œμ˜ μ‹œκ·Έλ‹ˆμ²˜κ°€ μ˜¬λ°”λ₯΄κ³  Spring Data의 μ €μž₯ λ©”μ„œλ“œ λͺ…λͺ… κ·œμΉ™μ„ λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€.


10-10: μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

findByAccountId λ©”μ„œλ“œμ˜ μ‹œκ·Έλ‹ˆμ²˜κ°€ μ˜¬λ°”λ₯΄κ³  Spring Data의 쑰회 λ©”μ„œλ“œ λͺ…λͺ… κ·œμΉ™μ„ λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€.


12-12: μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

existsByAccountId λ©”μ„œλ“œμ˜ μ‹œκ·Έλ‹ˆμ²˜κ°€ μ˜¬λ°”λ₯΄κ³  Spring Data의 쑴재 μ—¬λΆ€ 확인 λ©”μ„œλ“œ λͺ…λͺ… κ·œμΉ™μ„ λ”°λ₯΄κ³  μžˆμŠ΅λ‹ˆλ‹€.

src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt (1)

19-20: 잘 κ΅¬ν˜„λœ λ©”μ„œλ“œμž…λ‹ˆλ‹€!

UserRepositoryμ—μ„œ accountId둜 μ‚¬μš©μžλ₯Ό μ‘°νšŒν•˜κ³ , μ‚¬μš©μžκ°€ μ—†λŠ” 경우 UserNotFoundException을 λ˜μ§€λŠ” 것은 쒋은 λ°©λ²•μž…λ‹ˆλ‹€.

src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt Outdated Show resolved Hide resolved
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 74fb48d and 5b2b8e5.

Files selected for processing (1)
  • src/main/kotlin/org/meogo/global/jwt/JwtTokenProvider.kt (3 hunks)
Additional context used
detekt
src/main/kotlin/org/meogo/global/jwt/JwtTokenProvider.kt

[warning] 83-83: The caught exception is swallowed. The original exception could be lost.

(detekt.exceptions.SwallowedException)


[warning] 85-85: The caught exception is swallowed. The original exception could be lost.

(detekt.exceptions.SwallowedException)


[warning] 87-87: The caught exception is swallowed. The original exception could be lost.

(detekt.exceptions.SwallowedException)

Additional comments not posted (7)
src/main/kotlin/org/meogo/global/jwt/JwtTokenProvider.kt (7)

31-32: μ½”λ“œ λ³€κ²½ 사항이 μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

νƒ€μž… 좔둠을 μ‚¬μš©ν•˜μ—¬ μ½”λ“œλ₯Ό κ°„κ²°ν•˜κ²Œ λ§Œλ“€μ—ˆλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


36-36: 쒋은 λ¦¬νŒ©ν† λ§μ΄μ—μš”!

TokenResponse 객체λ₯Ό 직접 λ°˜ν™˜ν•˜λ„λ‘ λ³€κ²½ν•˜μ—¬ μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


40-41: μ½”λ“œ λ³€κ²½ 사항이 μ’‹μ•„ λ³΄μž…λ‹ˆλ‹€!

λ©”μ„œλ“œ 체이닝을 μ‚¬μš©ν•˜μ—¬ μ•‘μ„ΈμŠ€ 토큰을 μƒμ„±ν•˜λŠ” μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


50-51: λ¦¬νŒ©ν† λ§μ΄ 잘 λ˜μ—ˆμ–΄μš”!

λ©”μ„œλ“œ 체이닝을 μ‚¬μš©ν•˜μ—¬ λ¦¬ν”„λ ˆμ‹œ 토큰을 μƒμ„±ν•˜λŠ” μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


59-60: 쒋은 λ³€κ²½ μ‚¬ν•­μ΄μ—μš”!

토큰을 νŒŒμ‹±ν•œ κ²°κ³Όλ₯Ό 직접 λ°˜ν™˜ν•˜λ„λ‘ λ³€κ²½ν•˜μ—¬ μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


65-65: λ¦¬νŒ©ν† λ§μ΄ 잘 λ˜μ—ˆμ–΄μš”!

"Bearer " 접두사λ₯Ό μ œκ±°ν•œ 토큰을 직접 λ°˜ν™˜ν•˜λ„λ‘ λ³€κ²½ν•˜μ—¬ μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.


72-73: 쒋은 λ³€κ²½ μ‚¬ν•­μ΄μ—μš”!

UsernamePasswordAuthenticationToken 객체λ₯Ό 직접 λ°˜ν™˜ν•˜λ„λ‘ λ³€κ²½ν•˜μ—¬ μ½”λ“œκ°€ 더 κ°„κ²°ν•΄μ‘Œλ„€μš”. κΈ°λŠ₯μ—λŠ” 영ν–₯을 주지 μ•ŠμœΌλ©΄μ„œ 가독성이 ν–₯μƒλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

@meltapplee meltapplee merged commit 2254d0f into main Sep 2, 2024
2 checks passed
@meltapplee meltapplee deleted the 3-user branch September 2, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User
1 participant