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-20) user my page #21

Merged
merged 3 commits into from
Sep 6, 2024
Merged

πŸ„ :: (Meogo-20) user my page #21

merged 3 commits into from
Sep 6, 2024

Conversation

meltapplee
Copy link
Member

@meltapplee meltapplee commented Sep 6, 2024

close #20
α„‹α…²α„Œα…₯ α„†α…‘α„‹α…΅α„‘α…¦α„‹α…΅α„Œα…΅

Summary by CodeRabbit

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

    • νŠΉμ • μ‚¬μš©μžμ™€ κ΄€λ ¨λœ 리뷰λ₯Ό 검색할 수 μžˆλŠ” κΈ°λŠ₯ μΆ”κ°€.
    • μ‚¬μš©μž 정보λ₯Ό κ°€μ Έμ˜€κΈ° μœ„ν•œ μƒˆλ‘œμš΄ API μ—”λ“œν¬μΈνŠΈ /myPage μΆ”κ°€.
    • μ‚¬μš©μž κ΄€λ ¨ 데이터 응닡을 μœ„ν•œ MyPageResponse 데이터 클래슀 μΆ”κ°€.
    • μ‚¬μš©μž 정보λ₯Ό μ²˜λ¦¬ν•˜λŠ” MyPageService μ„œλΉ„μŠ€ 클래슀 μΆ”κ°€.
  • 버그 μˆ˜μ •

    • currentUser() ν•¨μˆ˜μ˜ λ°˜ν™˜ νƒ€μž…μ„ λ³€κ²½ν•˜μ—¬ null μ•ˆμ „μ„±μ„ κ°•ν™”.

@meltapplee meltapplee added the κΈ°λŠ₯개발 make something label Sep 6, 2024
@meltapplee meltapplee self-assigned this Sep 6, 2024
Copy link

coderabbitai bot commented Sep 6, 2024

Walkthrough

이번 λ³€κ²½ 사항은 μ‚¬μš©μž κ΄€λ ¨ 데이터λ₯Ό μ²˜λ¦¬ν•˜κΈ° μœ„ν•œ μƒˆλ‘œμš΄ κΈ°λŠ₯을 μΆ”κ°€ν•˜κ³ , κΈ°μ‘΄ κΈ°λŠ₯의 λ°˜ν™˜ νƒ€μž…μ„ μˆ˜μ •ν•˜λ©°, μ‚¬μš©μž 정보λ₯Ό μœ„ν•œ 응닡 객체λ₯Ό μ •μ˜ν•˜λŠ” 것을 ν¬ν•¨ν•©λ‹ˆλ‹€. ReviewRepository에 μ‚¬μš©μž ID둜 리뷰λ₯Ό κ²€μƒ‰ν•˜λŠ” λ©”μ„œλ“œκ°€ μΆ”κ°€λ˜μ—ˆκ³ , UserFacade의 currentUser() λ©”μ„œλ“œκ°€ λΉ„nullable둜 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ, UserController에 μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈκ°€ μΆ”κ°€λ˜κ³ , μ‚¬μš©μž 정보λ₯Ό λ°˜ν™˜ν•˜λŠ” μ„œλΉ„μŠ€κ°€ λ„μž…λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt findByUserId(userId: UUID): List<Review>? λ©”μ„œλ“œ μΆ”κ°€.
src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt currentUser() λ©”μ„œλ“œμ˜ λ°˜ν™˜ νƒ€μž…μ„ User?μ—μ„œ User둜 λ³€κ²½.
src/main/kotlin/org/meogo/domain/user/presentation/UserController.kt /myPage μ—”λ“œν¬μΈνŠΈ μΆ”κ°€ 및 MyPageService 톡합.
src/main/kotlin/org/meogo/domain/user/presentation/dto/response/MyPageResponse.kt MyPageResponse 데이터 클래슀 μΆ”κ°€, μ‚¬μš©μž 정보λ₯Ό μœ„ν•œ μ„Έ 가지 속성 μ •μ˜.
src/main/kotlin/org/meogo/domain/user/service/MyPageService.kt MyPageService 클래슀 μΆ”κ°€ 및 μ‚¬μš©μž 정보λ₯Ό λ°˜ν™˜ν•˜λŠ” execute() λ©”μ„œλ“œ κ΅¬ν˜„.

Sequence Diagram(s)

sequenceDiagram
    participant UserController
    participant MyPageService
    participant UserFacade
    participant MyPageResponse

    UserController->>MyPageService: myPage()
    MyPageService->>UserFacade: getCurrentUser()
    UserFacade-->>MyPageService: User
    MyPageService->>MyPageResponse: createResponse(user)
    MyPageResponse-->>MyPageService: MyPageResponse
    MyPageService-->>UserController: MyPageResponse
Loading

🐰 μƒˆλ‘œμš΄ κΈ°λŠ₯이 μƒκ²Όμ–΄μš”,
μ‚¬μš©μž 정보가 쏙 λ“€μ–΄μ™”μ£ !
리뷰도 μ°Ύκ³ , λ‚΄ νŽ˜μ΄μ§€λ„,
더 νŽΈλ¦¬ν•˜κ²Œ, λͺ¨λ‘μ™€ ν•¨κ»˜!
기쁘게 λ›°μ–΄λ‹€λ‹ˆλ©°,
λ³€ν™”μ˜ 좀을 μΆ°μš”! πŸŽ‰


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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4e98401 and a6aa509.

Files selected for processing (5)
  • src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt (2 hunks)
  • src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/presentation/UserController.kt (3 hunks)
  • src/main/kotlin/org/meogo/domain/user/presentation/dto/response/MyPageResponse.kt (1 hunks)
  • src/main/kotlin/org/meogo/domain/user/service/MyPageService.kt (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/kotlin/org/meogo/domain/user/presentation/dto/response/MyPageResponse.kt
Additional comments not posted (5)
src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt (1)

14-15: μƒˆλ‘œμš΄ λ©”μ„œλ“œ μΆ”κ°€ 승인

findByUserId λ©”μ„œλ“œλŠ” μ‚¬μš©μž ID둜 리뷰λ₯Ό κ²€μƒ‰ν•˜λŠ” κΈ°λŠ₯을 μΆ”κ°€ν•˜μ—¬ ReviewRepository μΈν„°νŽ˜μ΄μŠ€μ˜ κΈ°λŠ₯을 ν™•μž₯ν•©λ‹ˆλ‹€. 이 λ©”μ„œλ“œλŠ” UUIDλ₯Ό μ‚¬μš©ν•˜μ—¬ μ‚¬μš©μžλ₯Ό μ‹λ³„ν•˜λ©°, 리뷰가 μ—†λŠ” 경우λ₯Ό κ³ λ €ν•˜μ—¬ λ°˜ν™˜ νƒ€μž…μ΄ nullableμž…λ‹ˆλ‹€.

src/main/kotlin/org/meogo/domain/user/presentation/UserController.kt (4)

7-7: μƒˆλ‘œμš΄ 응닡 객체 μΆ”κ°€ 확인

MyPageResponse ν΄λž˜μŠ€κ°€ μž„ν¬νŠΈ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μƒˆλ‘œμš΄ /myPage μ—”λ“œν¬μΈνŠΈμ—μ„œ μ‚¬μš©μžμ˜ 데이터λ₯Ό λ°˜ν™˜ν•˜λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€.


9-9: μƒˆλ‘œμš΄ μ„œλΉ„μŠ€ μΆ”κ°€ 확인

MyPageService μ„œλΉ„μŠ€κ°€ μž„ν¬νŠΈ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 μ„œλΉ„μŠ€λŠ” /myPage μ—”λ“œν¬μΈνŠΈμ—μ„œ μ‚¬μš©μžμ˜ 상세 정보λ₯Ό κ°€μ Έμ˜€λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€.


26-27: μ˜μ‘΄μ„± μ£Όμž… 확인

UserController 클래슀의 μƒμ„±μžμ— myPageServiceκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μƒˆλ‘œμš΄ /myPage μ—”λ“œν¬μΈνŠΈμ˜ λ‘œμ§μ„ μ²˜λ¦¬ν•˜κΈ° μœ„ν•΄ ν•„μš”ν•©λ‹ˆλ‹€.


44-46: μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ μΆ”κ°€ 확인

@GetMapping("/myPage")을 톡해 μƒˆλ‘œμš΄ GET μ—”λ“œν¬μΈνŠΈκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ©”μ„œλ“œλŠ” MyPageServiceλ₯Ό μ‚¬μš©ν•˜μ—¬ MyPageResponse 객체λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€. μ΄λŠ” μ‚¬μš©μžμ˜ 상세 정보λ₯Ό μ œκ³΅ν•˜λŠ” μ€‘μš”ν•œ κΈ°λŠ₯μž…λ‹ˆλ‹€.

Comment on lines +14 to +21
fun execute(): MyPageResponse {
val user = userFacade.currentUser() ?: throw UserNotFoundException

return MyPageResponse(
user.name,
user.accountId,
user.profile!!
)
Copy link

@coderabbitai coderabbitai bot Sep 6, 2024

Choose a reason for hiding this comment

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

ν”„λ‘œν•„ 처리 방식 κ°œμ„  μ œμ•ˆ

execute λ©”μ„œλ“œμ—μ„œ user.profile에 λŒ€ν•œ non-null assertion (!!) μ‚¬μš©μ€ NullPointerException을 λ°œμƒμ‹œν‚¬ μœ„ν—˜μ΄ μžˆμŠ΅λ‹ˆλ‹€. μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬ν•˜κΈ° μœ„ν•΄ non-null assertion λŒ€μ‹  μ μ ˆν•œ μ˜ˆμ™Έ μ²˜λ¦¬λ‚˜ κΈ°λ³Έκ°’ μ œκ³΅μ„ κ³ λ €ν•΄μ•Ό ν•©λ‹ˆλ‹€.

- user.profile!!
+ user.profile ?: throw ProfileNotFoundException("Profile not found")
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
fun execute(): MyPageResponse {
val user = userFacade.currentUser() ?: throw UserNotFoundException
return MyPageResponse(
user.name,
user.accountId,
user.profile!!
)
fun execute(): MyPageResponse {
val user = userFacade.currentUser() ?: throw UserNotFoundException
return MyPageResponse(
user.name,
user.accountId,
user.profile ?: throw ProfileNotFoundException("Profile not found")
)

Copy link
Member Author

Choose a reason for hiding this comment

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

이건 λ‚˜μ€‘μ— s3λ₯Ό λ„μž…ν•΄μ„œ profile이 null이면 κΈ°λ³Έ 이미지λ₯Ό λ°˜ν™˜ν•˜λ„λ‘ ν• κ±°μ•Ό

Copy link

Choose a reason for hiding this comment

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

@meltapplee, understood! Your plan to handle null profiles with S3 and return a default image sounds good. Just make sure the current implementation is stable until the S3 integration is in place. If you need any assistance with that in the future, feel free to reach out! 😊

src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt Outdated Show resolved Hide resolved
@meltapplee meltapplee merged commit e0f82de into main Sep 6, 2024
2 checks passed
@meltapplee meltapplee deleted the 20-user-myPage branch September 6, 2024 14:35
This was referenced Sep 9, 2024
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.

μœ μ € λ§ˆμ΄νŽ˜μ΄μ§€
1 participant