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

πŸ”€ :: (PiCK-252)upload profile api #257

Merged
merged 8 commits into from
Oct 16, 2024
Merged

Conversation

meltapplee
Copy link
Member

@meltapplee meltapplee commented Jul 30, 2024

close #252
스크란샷 2024-10-16 14 10 21
스크란샷 2024-10-16 14 10 57
스크란샷 2024-10-16 14 11 10
스크란샷 2024-10-16 14 12 21

Summary by CodeRabbit

  • New Features

    • μ‚¬μš©μž ν”„λ‘œν•„ 사진 μ—…λ‘œλ“œ κΈ°λŠ₯ μΆ”κ°€.
    • μ‚¬μš©μž 정보 응닡에 ν”„λ‘œν•„ URL 포함.
    • μ‚¬μš©μž ν”„λ‘œν•„ 정보 응닡에 ν”„λ‘œν•„ ν•„λ“œ μΆ”κ°€.
    • μƒˆλ‘œμš΄ μ‚¬μš©μž ν”„λ‘œν•„ μ—…λ°μ΄νŠΈ λ©”μ„œλ“œ μΆ”κ°€.
    • μ‚¬μš©μž ν”„λ‘œν•„ μˆ˜μ • μΈν„°νŽ˜μ΄μŠ€ μΆ”κ°€.
    • μ‚¬μš©μž ν”„λ‘œν•„ μ—…λ‘œλ“œλ₯Ό μœ„ν•œ μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ μΆ”κ°€.
  • Bug Fixes

    • ν”„λ‘œν•„ 이미지 처리 둜직 κ°œμ„ .
  • Documentation

    • μ‚¬μš©μž ν”„λ‘œν•„ 관리 및 μ—…λ‘œλ“œ κ΄€λ ¨ API λ¬Έμ„œν™”.
  • Chores

    • λ³΄μ•ˆ μ„€μ • μ—…λ°μ΄νŠΈλ‘œ μ‚¬μš©μž ν”„λ‘œν•„ μ ‘κ·Ό κΆŒν•œ κ°•ν™”.

@meltapplee meltapplee added the κΈ°λŠ₯ 개발 API 개발 label Jul 30, 2024
@meltapplee meltapplee self-assigned this Jul 30, 2024
@meltapplee meltapplee requested a review from rudeh2926 as a code owner July 30, 2024 23:37
Copy link

coderabbitai bot commented Jul 30, 2024

Walkthrough

이번 변경사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μ—…λ‘œλ“œν•˜κ³  κ΄€λ¦¬ν•˜λŠ” κΈ°λŠ₯을 μΆ”κ°€ν•˜μ—¬, μ‚¬μš©μž 데이터 처리λ₯Ό κ°œμ„ ν•˜λŠ” 데 쀑점을 λ‘μ—ˆμŠ΅λ‹ˆλ‹€. QueryMyApplicationResponse 및 User 데이터 ν΄λž˜μŠ€μ— μƒˆλ‘œμš΄ ν”„λ‘œνΌν‹°λ₯Ό μΆ”κ°€ν•˜κ³ , μ—¬λŸ¬ μ„œλΉ„μŠ€μ—μ„œ ν”„λ‘œν•„ URL을 μƒμ„±ν•˜λŠ” λ‘œμ§μ„ ν†΅ν•©ν–ˆμŠ΅λ‹ˆλ‹€. 이둜써, μ‚¬μš©μž κ²½ν—˜μ„ ν–₯μƒμ‹œν‚€κ³ , API의 μœ μ—°μ„±μ„ λ†’μ˜€μŠ΅λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
.../dto/response/QueryMyApplicationResponse.kt QueryMyApplicationResponse에 profile 속성 μΆ”κ°€.
.../service/QueryMyApplicationService.kt FileUtil μ˜μ‘΄μ„± μΆ”κ°€ 및 ν”„λ‘œν•„ URL 생성 둜직 톡합.
.../domain/user/domain/User.kt User ν΄λž˜μŠ€μ— updateProfileFileName λ©”μ†Œλ“œ μΆ”κ°€.
.../dto/response/QueryUserSimpleInfoResponse.kt QueryUserSimpleInfoResponse에 profile 속성 μΆ”κ°€.
.../service/QueryUserSimpleInfoService.kt FileUtil μΆ”κ°€ 및 μ‚¬μš©μž ν”„λ‘œν•„ 이미지 URL 생성 둜직 λ³€κ²½.
.../port/in/ModifyProfileUseCase.kt ModifyProfileUseCase μΈν„°νŽ˜μ΄μŠ€ μΆ”κ°€ 및 modifyProfile λ©”μ†Œλ“œ μ •μ˜.
.../presentation/UserController.kt /profile κ²½λ‘œμ— λŒ€ν•œ ν”„λ‘œν•„ μ—…λ‘œλ“œ λ©”μ†Œλ“œ μΆ”κ°€.
.../service/UploadUserProfileService.kt μ‚¬μš©μž ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ 및 μ—…λ°μ΄νŠΈλ₯Ό μœ„ν•œ μƒˆλ‘œμš΄ μ„œλΉ„μŠ€ 클래슀 μΆ”κ°€.
.../global/config/security/SecurityConfig.kt Role.STU 역할에 λŒ€ν•œ μƒˆλ‘œμš΄ κΆŒν•œ κ·œμΉ™ μΆ”κ°€.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UserController
    participant UploadUserProfileService
    participant FileUtil

    User->>UserController: ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ μš”μ²­
    UserController->>UploadUserProfileService: uploadUserProfile(file)
    UploadUserProfileService->>FileUtil: κΈ°μ‘΄ ν”„λ‘œν•„ 이미지 μ‚­μ œ
    UploadUserProfileService->>FileUtil: μƒˆ ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ
    UploadUserProfileService->>UploadUserProfileService: μ‚¬μš©μž ν”„λ‘œν•„ μ—…λ°μ΄νŠΈ
    UploadUserProfileService-->>UserController: 응닡
    UserController-->>User: μ—…λ‘œλ“œ κ²°κ³Ό λ°˜ν™˜
Loading

Assessment against linked issues

Objective Addressed Explanation
μœ μ € ν”„λ‘œν•„μ΄λ―Έμ§€ κΈ°λŠ₯ μΆ”κ°€ ( #252 ) βœ…
ν”„λ‘œν•„ 이미지 URL 생성 ( #252 ) βœ…
API ν™•μž₯ 및 μ‚¬μš©μž κ²½ν—˜ κ°œμ„  ( #252 ) βœ…

Poem

πŸ‡
κ·€μ—¬μš΄ 토끼가 λ§ν•˜κΈΈ,
"ν”„λ‘œν•„ 이미지, μ΄μ œλŠ” μ—…λ‘œλ“œ!
μ‚¬μš©μž κ²½ν—˜, 훨씬 더 μ’‹μ•„μ‘Œλ„€,
λͺ¨λ“  λ³€ν™”κ°€ 더 λ‚˜μ€ 길둜,
ν•¨κ»˜ λ›°μ–΄λ†€μž, 기쁜 마음으둜!"
🌟


πŸ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 7635ff9 and 7b5e0c8.

πŸ“’ Files selected for processing (2)
  • src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt
  • src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt

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>, please review it.
    • 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 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 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: 0

Outside diff range, codebase verification and nitpick comments (3)
src/main/kotlin/dsm/pick2024/domain/user/port/in/UploadUserProfileUseCase.kt (1)

5-7: μΈν„°νŽ˜μ΄μŠ€μ— λ¬Έμ„œ 주석을 μΆ”κ°€ν•˜μ„Έμš”.

UploadUserProfileUseCase μΈν„°νŽ˜μ΄μŠ€μ™€ uploadUserProfile λ©”μ„œλ“œμ— λŒ€ν•œ λ¬Έμ„œ 주석이 ν•„μš”ν•©λ‹ˆλ‹€. μ΄λŠ” μ½”λ“œμ˜ 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ„ ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€.

/**
 * Interface for uploading user profile images.
 */
interface UploadUserProfileUseCase {
    /**
     * Uploads a user profile image.
     *
     * @param file the profile image file to upload
     */
    fun uploadUserProfile(file: MultipartFile)
}
src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (1)

21-21: fileUtil import λˆ„λ½ 확인

fileUtil.generateObjectUrl ν•¨μˆ˜κ°€ μ‚¬μš©λœ μ•„λž˜ νŒŒμΌλ“€μ—μ„œ fileUtil의 import 문이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이둜 인해 μ½”λ“œκ°€ μ˜¬λ°”λ₯΄κ²Œ μ»΄νŒŒμΌλ˜μ§€ μ•Šκ±°λ‚˜ μž‘λ™ν•˜μ§€ μ•Šμ„ 수 μžˆμŠ΅λ‹ˆλ‹€. fileUtil을 μ˜¬λ°”λ₯΄κ²Œ import ν•΄ μ£Όμ„Έμš”.

  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt
  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt
  • src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt
  • src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt
Analysis chain

ν”„λ‘œν•„ URL 생성 둜직 확인

fileUtil을 μ‚¬μš©ν•˜μ—¬ ν”„λ‘œν•„ URL을 μƒμ„±ν•˜λŠ” 둜직이 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό 더 효율적으둜 μ²˜λ¦¬ν•©λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜, fileUtil의 μ‚¬μš©μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆλŠ”μ§€ 확인해 μ£Όμ„Έμš”.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `fileUtil.generateObjectUrl`.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type kotlin -A 5 $'fileUtil.generateObjectUrl'

Length of output: 2598


Script:

#!/bin/bash
# Description: Verify the import of `fileUtil` in the identified files.

# Test: Check for the import statements of `fileUtil` in the identified files.
files=(
  "src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt"
  "src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt"
  "src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt"
  "src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt"
)

for file in "${files[@]}"; do
  echo "File: $file"
  rg --type kotlin "import .*fileUtil" "$file"
  echo
done

Length of output: 1605

src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt (1)

106-107: μ—”λ“œν¬μΈνŠΈ κ΅¬ν˜„ λˆ„λ½ 확인

/user/profile μ—”λ“œν¬μΈνŠΈκ°€ λ³΄μ•ˆ 섀정에 μΆ”κ°€λ˜μ—ˆμœΌλ‚˜, μ‹€μ œλ‘œ 이λ₯Ό μ²˜λ¦¬ν•˜λŠ” μ»¨νŠΈλ‘€λŸ¬λ‚˜ μ„œλΉ„μŠ€ λ©”μ„œλ“œκ°€ κ΅¬ν˜„λ˜μ§€ μ•Šμ€ κ²ƒμœΌλ‘œ λ³΄μž…λ‹ˆλ‹€. 이둜 인해 ν•΄λ‹Ή μ—”λ“œν¬μΈνŠΈκ°€ μ •μƒμ μœΌλ‘œ μž‘λ™ν•˜μ§€ μ•Šμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.

  • SecurityConfig.kt νŒŒμΌμ—μ„œ /user/profile μ—”λ“œν¬μΈνŠΈκ°€ 보호되고 μžˆλŠ” 것을 ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.
  • κ·ΈλŸ¬λ‚˜, 이 μ—”λ“œν¬μΈνŠΈλ₯Ό μ²˜λ¦¬ν•˜λŠ” μ»¨νŠΈλ‘€λŸ¬λ‚˜ μ„œλΉ„μŠ€ λ©”μ„œλ“œκ°€ μ½”λ“œλ² μ΄μŠ€μ— μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

μ—”λ“œν¬μΈνŠΈμ˜ κΈ°λŠ₯을 κ΅¬ν˜„ν•˜μ—¬ μ˜ˆμƒλŒ€λ‘œ μž‘λ™ν•˜λ„λ‘ ν•˜λŠ” 것이 ν•„μš”ν•©λ‹ˆλ‹€.

Analysis chain

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

/user/profile μ—”λ“œν¬μΈνŠΈκ°€ Role.STU 역할을 μš”κ΅¬ν•˜λŠ” 경둜 λͺ©λ‘μ— μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ‚¬μš©μž ν”„λ‘œν•„ 정보에 λŒ€ν•œ 접근을 μ œν•œν•˜λ €λŠ” μ˜λ„μ™€ μΌμΉ˜ν•©λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜, 이 μ—”λ“œν¬μΈνŠΈμ˜ κΈ°λŠ₯이 μ˜ˆμƒλŒ€λ‘œ μž‘λ™ν•˜λŠ”μ§€ ν™•μΈν•˜λŠ” 것이 μ€‘μš”ν•©λ‹ˆλ‹€.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the functionality of the new endpoint `/user/profile`.

# Test: Ensure the endpoint is protected and accessible only by users with the `Role.STU` role.
rg --type kotlin -A 5 $'"/user/profile"'

Length of output: 653


Script:

#!/bin/bash
# Description: Search for the implementation details of the `/user/profile` endpoint.

# Find the controller or service methods handling the `/user/profile` endpoint.
rg --type kotlin '"/user/profile"'

Length of output: 138


Script:

#!/bin/bash
# Description: Search for the implementation details of the `/user/profile` endpoint across all Kotlin files.

# Find the controller or service methods handling the `/user/profile` endpoint.
rg --type kotlin 'user/profile'

Length of output: 133

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 76090f0 and 036b5c3.

Files selected for processing (11)
  • src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/response/QueryMyApplicationResponse.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/port/in/UploadUserProfileUseCase.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/UserController.kt (3 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt
Additional comments not posted (12)
src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt (1)

4-4: λ³€κ²½ 사항 승인됨

QueryUserSimpleInfoResponse 데이터 ν΄λž˜μŠ€μ— profile 속성을 μΆ”κ°€ν•œ 것은 μœ μ—°μ„±μ„ 높이고 μ‚¬μš©μž 정보λ₯Ό 더 잘 전달할 수 있게 ν•©λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/response/QueryMyApplicationResponse.kt (1)

15-15: λ³€κ²½ 사항 승인됨

QueryMyApplicationResponse 데이터 ν΄λž˜μŠ€μ— profile 속성을 μΆ”κ°€ν•œ 것은 응닡 데이터 ꡬ쑰의 μœ μ—°μ„±μ„ 높이고 좔가적인 μ‚¬μš©μž 정보λ₯Ό μ œκ³΅ν•  수 있게 ν•©λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt (1)

21-23: μƒˆλ‘œμš΄ λ©”μ„œλ“œ μΆ”κ°€: updateProfileFileName

이 λ©”μ„œλ“œλŠ” User 클래슀의 profile 속성을 μ—…λ°μ΄νŠΈν•˜λ©΄μ„œ λΆˆλ³€μ„±μ„ μœ μ§€ν•©λ‹ˆλ‹€. μ½”λ“œκ°€ λͺ…ν™•ν•˜κ³  μ½”ν‹€λ¦°μ˜ λͺ¨λ²” 사둀λ₯Ό λ”°λ¦…λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt (3)

6-7: μƒˆλ‘œμš΄ μ˜μ‘΄μ„± μΆ”κ°€: FileUtil

FileUtil을 ν™œμš©ν•˜μ—¬ 파일 처리λ₯Ό μœ„ν•œ κΈ°λŠ₯이 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.


13-14: μƒμ„±μž μ—…λ°μ΄νŠΈ: FileUtil μ˜μ‘΄μ„± μ£Όμž…

FileUtil을 μƒμ„±μžμ— μΆ”κ°€ν•˜μ—¬ 파일 처리λ₯Ό μœ„ν•œ μ˜μ‘΄μ„±μ„ μ£Όμž…ν•©λ‹ˆλ‹€.


20-26: λ©”μ„œλ“œ μ—…λ°μ΄νŠΈ: queryUserSimpleInfo

μ‚¬μš©μžμ˜ ν”„λ‘œν•„ 이미지 URL을 μƒμ„±ν•˜κ³  응닡에 ν¬ν•¨μ‹œν‚€λŠ” 둜직이 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ„œλΉ„μŠ€μ˜ κΈ°λŠ₯을 ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1)

1-28: μƒˆλ‘œμš΄ μ„œλΉ„μŠ€ 클래슀 μΆ”κ°€: UploadUserProfileService

이 ν΄λž˜μŠ€λŠ” ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œλ₯Ό μ²˜λ¦¬ν•˜λŠ” κΈ°λŠ₯을 ν¬ν•¨ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ½”λ“œ ꡬ쑰가 잘 λ˜μ–΄ 있으며 λͺ¨λ²” 사둀λ₯Ό λ”°λ¦…λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (1)

13-14: μ˜μ‘΄μ„± μΆ”κ°€ 확인

fileUtil μ˜μ‘΄μ„±μ΄ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μœ„ν•œ URL 생성을 κ°€λŠ₯ν•˜κ²Œ ν•©λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2)

18-19: μ˜μ‘΄μ„± μΆ”κ°€ 확인

fileUtil μ˜μ‘΄μ„±μ΄ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μœ„ν•œ URL 생성을 κ°€λŠ₯ν•˜κ²Œ ν•©λ‹ˆλ‹€.


39-39: ν”„λ‘œν•„ URL 생성 둜직 확인

fileUtil을 μ‚¬μš©ν•˜μ—¬ ν”„λ‘œν•„ URL을 μƒμ„±ν•˜λŠ” 둜직이 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό 더 효율적으둜 μ²˜λ¦¬ν•©λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜, fileUtil의 μ‚¬μš©μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆλŠ”μ§€ 확인해 μ£Όμ„Έμš”.

Verification successful

ν”„λ‘œν•„ URL 생성 둜직 확인 μ™„λ£Œ

fileUtil.generateObjectUrl ν•¨μˆ˜κ°€ μ—¬λŸ¬ νŒŒμΌμ—μ„œ μΌκ΄€λ˜κ²Œ μ‚¬μš©λ˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ‚¬μš©μž ν”„λ‘œν•„ 이미지 및 기타 νŒŒμΌμ„ μ²˜λ¦¬ν•˜λŠ” ν‘œμ€€ μ ‘κ·Ό 방식을 λ‚˜νƒ€λƒ…λ‹ˆλ‹€. λ”°λΌμ„œ, ν•΄λ‹Ή ν•¨μˆ˜μ˜ μ‚¬μš©μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆμŒμ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.

  • QueryUserSimpleInfoService.kt
  • QueryUserDetaileInfoService.kt
  • AddBugService.kt
  • QueryMyApplicationService.kt
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `fileUtil.generateObjectUrl`.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type kotlin -A 5 $'fileUtil.generateObjectUrl'

Length of output: 2598

src/main/kotlin/dsm/pick2024/domain/user/presentation/UserController.kt (2)

32-33: μ˜μ‘΄μ„± μΆ”κ°€ 확인

uploadUserProfileUseCase μ˜μ‘΄μ„±μ΄ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ μ—…λ‘œλ“œλ₯Ό μ²˜λ¦¬ν•˜λŠ” κΈ°λŠ₯을 κ°€λŠ₯ν•˜κ²Œ ν•©λ‹ˆλ‹€.


59-60: ν”„λ‘œν•„ μ—…λ‘œλ“œ μ—”λ“œν¬μΈνŠΈ μΆ”κ°€ 확인

μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μ—…λ‘œλ“œν•˜λŠ” μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 관리λ₯Ό ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜, uploadUserProfileUseCase의 μ‚¬μš©μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆλŠ”μ§€ 확인해 μ£Όμ„Έμš”.

Verification successful

ν”„λ‘œν•„ μ—…λ‘œλ“œ μ—”λ“œν¬μΈνŠΈ μΆ”κ°€ 확인

μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μ—…λ‘œλ“œν•˜λŠ” μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 관리λ₯Ό ν–₯μƒμ‹œν‚΅λ‹ˆλ‹€.

λ˜ν•œ, uploadUserProfileUseCase의 μ‚¬μš©μ΄ μ˜¬λ°”λ₯΄κ²Œ μ μš©λ˜μ—ˆμŒμ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `uploadUserProfileUseCase.uploadUserProfile`.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type kotlin -A 5 $'uploadUserProfileUseCase.uploadUserProfile'

Length of output: 320

@meltapplee meltapplee closed this Jul 31, 2024
@meltapplee meltapplee reopened this Oct 16, 2024
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 and nitpick comments (7)
src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt (1)

5-5: LGTM! ν”„λ‘œν•„ 경둜 μƒμˆ˜κ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μƒˆλ‘œμš΄ PROFILE μƒμˆ˜κ°€ μ μ ˆν•˜κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” κΈ°μ‘΄ μƒμˆ˜λ“€κ³Ό μΌκ΄€λœ λͺ…λͺ… κ·œμΉ™κ³Ό κ°’ ν˜•μ‹μ„ λ”°λ₯΄κ³  μžˆμ–΄ μ’‹μŠ΅λ‹ˆλ‹€.

μ½”λ“œμ˜ 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ„ λ”μš± ν–₯μƒμ‹œν‚€κΈ° μœ„ν•΄, 각 μƒμˆ˜μ— λŒ€ν•œ κ°„λ‹¨ν•œ 주석을 μΆ”κ°€ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ‹œλŠ” 것은 μ–΄λ–¨κΉŒμš”? 예λ₯Ό λ“€μ–΄:

/** ν”„λ‘œν•„ 이미지 μ €μž₯ 경둜 */
const val PROFILE = "PROFILE/"
src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt (1)

7-8: ν”„λ‘œν•„ 이미지 URL을 μœ„ν•œ 속성 μΆ”κ°€ 승인

μƒˆλ‘œμš΄ profile μ†μ„±μ˜ μΆ”κ°€λŠ” μ‚¬μš©μž ν”„λ‘œν•„ 이미지 κΈ°λŠ₯ κ΅¬ν˜„μ„ μœ„ν•œ 쒋은 μ ‘κ·Ό λ°©μ‹μž…λ‹ˆλ‹€. nullable νƒ€μž…κ³Ό κΈ°λ³Έκ°’ null μ‚¬μš©μ€ 이전 λ²„μ „κ³Όμ˜ ν˜Έν™˜μ„±μ„ μœ μ§€ν•˜λ©΄μ„œ ν”„λ‘œν•„ 이미지가 μ—†λŠ” μ‚¬μš©μžλ₯Ό μ²˜λ¦¬ν•  수 있게 ν•΄μ€λ‹ˆλ‹€.

더 λͺ…ν™•ν•œ 의미 전달을 μœ„ν•΄ profile λŒ€μ‹  profileImageUrlκ³Ό 같은 더 ꡬ체적인 이름을 μ‚¬μš©ν•˜λŠ” 것이 μ–΄λ–¨κΉŒμš”? μ΄λ ‡κ²Œ ν•˜λ©΄ 이 속성이 μ •ν™•νžˆ 무엇을 λ‚˜νƒ€λ‚΄λŠ”μ§€ 더 λͺ…ν™•ν•΄μ§ˆ 것 κ°™μŠ΅λ‹ˆλ‹€.

data class QueryUserSimpleInfoResponse(
    val userName: String,
    val grade: Int,
    val classNum: Int,
    val num: Int,
-   val profile: String? = null,
+   val profileImageUrl: String? = null,
)
src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt (1)

23-25: 쒋은 κ΅¬ν˜„μž…λ‹ˆλ‹€. μ•½κ°„μ˜ κ°œμ„  μ œμ•ˆμ΄ μžˆμŠ΅λ‹ˆλ‹€.

updateProfileFileName λ©”μ„œλ“œμ˜ κ΅¬ν˜„μ΄ 잘 λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λΆˆλ³€μ„±μ„ μœ μ§€ν•˜λ©΄μ„œ ν”„λ‘œν•„ 파일 이름을 μ—…λ°μ΄νŠΈν•˜λŠ” 방식이 μ μ ˆν•©λ‹ˆλ‹€. λ‹€λ§Œ, 더 λ‚˜μ€ null μ•ˆμ „μ„±μ„ μœ„ν•΄ λ‹€μŒκ³Ό 같은 μž‘μ€ κ°œμ„ μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

fun updateProfileFileName(fileName: String?): User {
-    return this.copy(profile = fileName)
+    return this.copy(profile = fileName?.takeIf { it.isNotBlank() })
}

μ΄λ ‡κ²Œ ν•˜λ©΄ 빈 λ¬Έμžμ—΄μ΄ 듀어왔을 λ•Œλ„ null둜 μ²˜λ¦¬λ˜μ–΄ 더 μ•ˆμ „ν•œ μ½”λ“œκ°€ λ©λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (2)

13-14: μƒμ„±μž 변경이 적절히 μ΄λ£¨μ–΄μ‘ŒμŠ΅λ‹ˆλ‹€.

FileUtil을 μ˜μ‘΄μ„±μœΌλ‘œ μΆ”κ°€ν•œ 것은 ν”„λ‘œν•„ 이미지 URL 생성 κΈ°λŠ₯ κ΅¬ν˜„μ— ν•„μš”ν•œ 쒋은 λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€. μ΄λŠ” μ˜μ‘΄μ„± μ£Όμž… νŒ¨ν„΄μ„ λ”°λ₯΄κ³  μžˆμ–΄ ν…ŒμŠ€νŠΈ μš©μ΄μ„±κ³Ό μœ μ—°μ„±μ„ λ†’μž…λ‹ˆλ‹€.

가독성을 높이기 μœ„ν•΄ 각 λ§€κ°œλ³€μˆ˜λ₯Ό λ³„λ„μ˜ 쀄에 λ°°μΉ˜ν•˜λŠ” 것을 κ³ λ €ν•΄ λ³΄μ„Έμš”. 예λ₯Ό λ“€λ©΄:

class QueryUserDetaileInfoService(
    private val userFacadeUseCase: UserFacadeUseCase,
    private val fileUtil: FileUtil
) : QueryUserDetailsInfoUseCase {
    // ...
}

21-21: queryUserDetailsInfo λ©”μ„œλ“œμ˜ 변경이 적절히 μ΄λ£¨μ–΄μ‘ŒμŠ΅λ‹ˆλ‹€.

ν”„λ‘œν•„ 이미지 URL 생성을 μœ„ν•΄ fileUtil.generateObjectUrl을 μ‚¬μš©ν•œ 것은 쒋은 λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€. null μ•ˆμ „ ν˜ΈμΆœμ„ μ‚¬μš©ν•˜μ—¬ 잠재적인 null 값을 μ²˜λ¦¬ν•œ 것도 ν›Œλ₯­ν•©λ‹ˆλ‹€.

μ½”λ“œμ˜ 가독성을 높이기 μœ„ν•΄ λ‹€μŒκ³Ό 같이 변경을 κ³ λ €ν•΄ λ³΄μ„Έμš”:

profile = user.profile?.let { profile ->
    fileUtil.generateObjectUrl(profile, PathList.PROFILE)
},

μ΄λ ‡κ²Œ ν•˜λ©΄ it의 μ˜λ―Έκ°€ 더 λͺ…확해지고, μ½”λ“œμ˜ μ˜λ„λ₯Ό 더 잘 전달할 수 μžˆμŠ΅λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2)

19-20: μƒμ„±μžμ— μƒˆλ‘œμš΄ μ˜μ‘΄μ„±μ΄ 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

FileUtil을 μƒμ„±μž λ§€κ°œλ³€μˆ˜λ‘œ μΆ”κ°€ν•œ 것은 μƒˆλ‘œμš΄ κΈ°λŠ₯ κ΅¬ν˜„μ— ν•„μš”ν•œ μ μ ˆν•œ λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€. λ‹€λ§Œ, μ˜μ‘΄μ„± μ£Όμž…μ˜ 일관성을 μœ„ν•΄ private val ν‚€μ›Œλ“œλ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”:

-private val queryApplicationPort: QueryApplicationPort,
-fileUtil: FileUtil
+private val queryApplicationPort: QueryApplicationPort,
+private val fileUtil: FileUtil

42-42: ν”„λ‘œν•„ URL 생성 둜직이 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ‚¬μš©μž ν”„λ‘œν•„ 이미지 URL을 μƒμ„±ν•˜λŠ” 둜직이 잘 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. null μ•ˆμ „ 호좜 μ—°μ‚°μž ?.λ₯Ό μ‚¬μš©ν•˜μ—¬ ν”„λ‘œν•„μ΄ μ‘΄μž¬ν•  λ•Œλ§Œ URL을 μƒμ„±ν•˜λŠ” 것은 쒋은 λ°©μ‹μž…λ‹ˆλ‹€.

μ½”λ“œμ˜ 가독성을 높이기 μœ„ν•΄ λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”:

-profile = user.profile?.let { fileUtil.generateObjectUrl(it, PathList.PROFILE) }
+profile = user.profile?.let { profile -> fileUtil.generateObjectUrl(profile, PathList.PROFILE) }

μ΄λ ‡κ²Œ ν•˜λ©΄ it의 μ˜λ―Έκ°€ 더 λͺ…ν™•ν•΄μ§‘λ‹ˆλ‹€.

πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 036b5c3 and 333066d.

πŸ“’ Files selected for processing (6)
  • src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt (1 hunks)
🧰 Additional context used
πŸ”‡ Additional comments (6)
src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserDetaileInfoService.kt (2)

6-7: μƒˆλ‘œμš΄ import 문이 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

FileUtilκ³Ό PathList의 importκ°€ μΆ”κ°€λ˜μ–΄ 클래슀의 μƒˆλ‘œμš΄ κΈ°λŠ₯을 μ§€μ›ν•©λ‹ˆλ‹€. μ΄λŠ” ν”„λ‘œν•„ 이미지 URL 생성 κΈ°λŠ₯ κ΅¬ν˜„μ— ν•„μš”ν•œ λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€.


Line range hint 1-30: μ „λ°˜μ μΈ λ³€κ²½ 사항이 PR λͺ©ν‘œμ™€ μΌμΉ˜ν•©λ‹ˆλ‹€.

이 PR의 λ³€κ²½ 사항은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ κΈ°λŠ₯ κ΅¬ν˜„μ΄λΌλŠ” λͺ©ν‘œλ₯Ό 잘 λ‹¬μ„±ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. FileUtil을 ν†΅ν•©ν•˜μ—¬ ν”„λ‘œν•„ 이미지 URL을 μƒμ„±ν•˜λŠ” κΈ°λŠ₯이 μΆ”κ°€λ˜μ—ˆκ³ , μ΄λŠ” #252 μ΄μŠˆμ—μ„œ μš”κ΅¬ν•˜λŠ” μ‚¬μš©μž ν”„λ‘œν•„ 이미지 κΈ°λŠ₯을 μ§€μ›ν•©λ‹ˆλ‹€.

μ£Όμš” λ³€κ²½ 사항:

  1. FileUtil μ˜μ‘΄μ„± μΆ”κ°€
  2. ν”„λ‘œν•„ 이미지 URL 생성 둜직 κ΅¬ν˜„

μ΄λŸ¬ν•œ λ³€κ²½μœΌλ‘œ μ‚¬μš©μž κ²½ν—˜μ΄ ν–₯μƒλ˜κ³  API의 μœ μ—°μ„±μ΄ λ†’μ•„μ§ˆ κ²ƒμœΌλ‘œ μ˜ˆμƒλ©λ‹ˆλ‹€. μ½”λ“œλŠ” μ „λ°˜μ μœΌλ‘œ 잘 κ΅¬μ‘°ν™”λ˜μ–΄ 있으며, λͺ‡ 가지 minorν•œ κ°œμ„  μ œμ•ˆμ„ μ œμ™Έν•˜λ©΄ 큰 λ¬Έμ œμ μ€ μ—†μŠ΅λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2)

11-12: μƒˆλ‘œμš΄ import 문이 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

FileUtilκ³Ό PathListλ₯Ό importν•˜λŠ” 것은 μƒˆλ‘œμš΄ κΈ°λŠ₯ κ΅¬ν˜„μ— ν•„μš”ν•œ μ μ ˆν•œ λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€. μ΄λŠ” μ½”λ“œμ˜ 가독성과 ꡬ쑰λ₯Ό κ°œμ„ ν•˜λŠ” 데 도움이 λ©λ‹ˆλ‹€.


Line range hint 1-48: μ „λ°˜μ μΈ 변경사항이 PR의 λͺ©μ μ— λΆ€ν•©ν•˜λ©° 잘 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

이 PR은 μ‚¬μš©μž ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ APIλ₯Ό κ΅¬ν˜„ν•˜λŠ” 데 μ„±κ³΅μ μœΌλ‘œ κΈ°μ—¬ν–ˆμŠ΅λ‹ˆλ‹€. μ½”λ“œ 변경사항은 λͺ…ν™•ν•˜κ³  일관성 있게 μ μš©λ˜μ—ˆμœΌλ©°, μƒˆλ‘œμš΄ κΈ°λŠ₯을 효과적으둜 ν†΅ν•©ν–ˆμŠ΅λ‹ˆλ‹€. μ œμ•ˆλœ minor κ°œμ„ μ‚¬ν•­λ“€μ„ κ³ λ €ν•΄ λ³΄μ‹œκΈ° λ°”λžλ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ FileUtilκ³Ό PathList의 μ‚¬μš©μ΄ μΌκ΄€λ˜κ²Œ μ μš©λ˜μ—ˆλŠ”μ§€ ν™•μΈν•΄λ³΄μ„Έμš”:

βœ… Verification successful

확인 μ™„λ£Œ: FileUtil 및 PathList μ‚¬μš© 일관성

PR의 변경사항이 μ½”λ“œλ² μ΄μŠ€ μ „λ°˜μ— 걸쳐 μΌκ΄€λ˜κ²Œ μ μš©λ˜μ—ˆμŒμ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€. 좔가적인 λ¬Έμ œκ°€ λ°œκ²¬λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# FileUtilκ³Ό PathList의 μ‚¬μš©μ„ ν™•μΈν•©λ‹ˆλ‹€.

echo "Checking FileUtil usage:"
rg --type kotlin "FileUtil" -A 5

echo "\nChecking PathList usage:"
rg --type kotlin "PathList" -A 5

Length of output: 25693

src/main/kotlin/dsm/pick2024/global/config/security/SecurityConfig.kt (2)

Line range hint 121-134: 학생 κΆŒν•œμ— λŒ€ν•œ GET μ—”λ“œν¬μΈνŠΈ μΆ”κ°€ 승인

학생 μ—­ν• (Role.STU)에 λŒ€ν•œ GET μš”μ²­ μ—”λ“œν¬μΈνŠΈ μΆ”κ°€κ°€ μ μ ˆν•΄ λ³΄μž…λ‹ˆλ‹€. μ΄λŠ” 학생듀이 ν•„μš”ν•œ 정보에 μ ‘κ·Όν•  수 μžˆλ„λ‘ ν•˜λŠ” 데 도움이 될 κ²ƒμž…λ‹ˆλ‹€.

λ‹€λ§Œ, "/notification/**" μ—”λ“œν¬μΈνŠΈλŠ” μ—¬μ „νžˆ λ„ˆλ¬΄ κ΄‘λ²”μœ„ν•  수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒκ³Ό 같이 더 ꡬ체적인 μ—”λ“œν¬μΈνŠΈλ₯Ό κ³ λ €ν•΄ λ³΄μ„Έμš”:

"/notification/my/**"

μ΄λ ‡κ²Œ ν•˜λ©΄ 학생듀이 μžμ‹ μ˜ μ•Œλ¦Όλ§Œ λ³Ό 수 μžˆλ„λ‘ μ œν•œν•  수 μžˆμŠ΅λ‹ˆλ‹€.


Line range hint 135-149: μƒˆλ‘œμš΄ μ—”λ“œν¬μΈνŠΈ 좔가에 λŒ€ν•œ 승인 및 λ³΄μ•ˆ κ°•ν™” μ œμ•ˆ

학생(Role.STU)을 μœ„ν•œ DELETE μ—”λ“œν¬μΈνŠΈμ™€ ꡐ직원(Role.SCH)을 μœ„ν•œ GET μ—”λ“œν¬μΈνŠΈ μΆ”κ°€κ°€ μ μ ˆν•΄ λ³΄μž…λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ "/weekend-meal/excel" 및 "/weekend-meal/excel/grade"와 같은 μ—”λ“œν¬μΈνŠΈλŠ” λŒ€λŸ‰μ˜ 데이터λ₯Ό λ‹€λ£° 수 μžˆμœΌλ―€λ‘œ, 좔가적인 λ³΄μ•ˆ 쑰치λ₯Ό κ³ λ €ν•΄ λ³΄μ‹œκΈ° λ°”λžλ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄:

  1. μš”μ²­ λΉˆλ„ μ œν•œ (Rate limiting) κ΅¬ν˜„
  2. 데이터 μ•”ν˜Έν™”
  3. λ‘œκΉ… κ°•ν™”

λ˜ν•œ, μ΄λŸ¬ν•œ μ—”λ“œν¬μΈνŠΈμ— λŒ€ν•œ 접근을 νŠΉμ • κ΄€λ¦¬μž μ—­ν• λ‘œ λ”μš± μ œν•œν•˜λŠ” 것도 κ³ λ €ν•΄ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

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

🧹 Outside diff range and nitpick comments (4)
src/main/kotlin/dsm/pick2024/domain/user/port/in/ModifyProfileUseCase.kt (1)

1-7: μΈν„°νŽ˜μ΄μŠ€ ꡬ쑰가 잘 μ„€κ³„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Clean Architecture νŒ¨ν„΄μ„ λ”°λ₯΄λŠ” 쒋은 μΈν„°νŽ˜μ΄μŠ€ μ„€κ³„μž…λ‹ˆλ‹€. ν•˜μ§€λ§Œ λͺ‡ 가지 κ°œμ„ ν•  점이 μžˆμŠ΅λ‹ˆλ‹€:

  1. modifyProfile λ©”μ„œλ“œμ— λ°˜ν™˜ νƒ€μž…μ„ μΆ”κ°€ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, μ—…λ°μ΄νŠΈλœ ν”„λ‘œν•„ URL을 λ°˜ν™˜ν•˜κ±°λ‚˜ 성곡/μ‹€νŒ¨ μ—¬λΆ€λ₯Ό λ‚˜νƒ€λ‚΄λŠ” λΆˆλ¦¬μ–Έ 값을 λ°˜ν™˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

  2. μΈν„°νŽ˜μ΄μŠ€μ™€ λ©”μ„œλ“œμ— KDoc λ¬Έμ„œλ₯Ό μΆ”κ°€ν•˜μ—¬ μ‚¬μš© λͺ©μ κ³Ό λ§€κ°œλ³€μˆ˜μ— λŒ€ν•œ μ„€λͺ…을 μ œκ³΅ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 μ œμ•ˆν•©λ‹ˆλ‹€:

 package dsm.pick2024.domain.user.port.`in`

 import org.springframework.web.multipart.MultipartFile

+/**
+ * μ‚¬μš©μž ν”„λ‘œν•„ μˆ˜μ •μ„ μœ„ν•œ μœ μŠ€μΌ€μ΄μŠ€ μΈν„°νŽ˜μ΄μŠ€
+ */
 interface ModifyProfileUseCase {
+    /**
+     * μ‚¬μš©μž ν”„λ‘œν•„ 이미지λ₯Ό μˆ˜μ •ν•©λ‹ˆλ‹€.
+     *
+     * @param multipartFile μ—…λ‘œλ“œν•  ν”„λ‘œν•„ 이미지 파일
+     * @return μ—…λ°μ΄νŠΈλœ ν”„λ‘œν•„ 이미지 URL
+     */
-    fun modifyProfile(multipartFile: MultipartFile)
+    fun modifyProfile(multipartFile: MultipartFile): String
 }
src/main/kotlin/dsm/pick2024/domain/user/presentation/UserController.kt (2)

22-22: import λ¬Έ μΆ”κ°€λŠ” μ μ ˆν•˜λ‚˜, μˆœμ„œ 쑰정이 ν•„μš”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

MultipartFile을 μœ„ν•œ import 문이 μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” 파일 μ—…λ‘œλ“œ μ²˜λ¦¬μ— ν•„μš”ν•©λ‹ˆλ‹€. λ‹€λ§Œ, κΈ°μ‘΄ import 문의 μˆœμ„œμ™€ 일관성을 μœ μ§€ν•˜κΈ° μœ„ν•΄ μœ„μΉ˜λ₯Ό μ‘°μ •ν•˜λŠ” 것이 쒋을 수 μžˆμŠ΅λ‹ˆλ‹€.

import 문을 μ•ŒνŒŒλ²³ μˆœμ„œλ‘œ μ •λ ¬ν•˜κ±°λ‚˜, 기쑴의 κ·Έλ£Ήν™” 방식을 따라 μ μ ˆν•œ μœ„μΉ˜λ‘œ μ΄λ™ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.


59-61: μƒˆλ‘œμš΄ λ©”μ„œλ“œκ°€ μΆ”κ°€λ˜μ—ˆμ§€λ§Œ, λͺ‡ 가지 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

ν”„λ‘œν•„ μ—…λ‘œλ“œλ₯Ό μœ„ν•œ μƒˆ μ—”λ“œν¬μΈνŠΈκ°€ μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ λ‹€μŒ 사항듀을 κ³ λ €ν•΄ λ³΄μ‹œκΈ° λ°”λžλ‹ˆλ‹€:

  1. λ©”μ„œλ“œ 이름: "upload"λŠ” λ‹€μ†Œ μΌλ°˜μ μž…λ‹ˆλ‹€. "uploadUserProfile"κ³Ό 같이 더 ꡬ체적인 이름을 μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.
  2. 였λ₯˜ 처리: 파일 μ—…λ‘œλ“œ μ‹€νŒ¨ μ‹œ μ˜ˆμ™Έ μ²˜λ¦¬κ°€ ν•„μš”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
  3. μž…λ ₯ μœ νš¨μ„± 검사: 파일 크기, ν˜•μ‹ 등에 λŒ€ν•œ 검증이 ν•„μš”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 λ©”μ„œλ“œλ₯Ό κ°œμ„ ν•΄ λ³΄μ„Έμš”:

@Operation(summary = "μœ μ € ν”„λ‘œν•„ μ—…λ‘œλ“œ API")
@PatchMapping("/profile")
fun uploadUserProfile(@RequestParam("file") file: MultipartFile): ResponseEntity<String> {
    return try {
        // 파일 μœ νš¨μ„± 검사
        if (file.isEmpty) {
            return ResponseEntity.badRequest().body("파일이 λΉ„μ–΄ μžˆμŠ΅λ‹ˆλ‹€.")
        }
        if (!file.contentType?.startsWith("image/") == true) {
            return ResponseEntity.badRequest().body("이미지 파일만 μ—…λ‘œλ“œ κ°€λŠ₯ν•©λ‹ˆλ‹€.")
        }
        // μ΅œλŒ€ 파일 크기 검사 (예: 5MB)
        if (file.size > 5 * 1024 * 1024) {
            return ResponseEntity.badRequest().body("파일 ν¬κΈ°λŠ” 5MBλ₯Ό μ΄ˆκ³Όν•  수 μ—†μŠ΅λ‹ˆλ‹€.")
        }

        val result = uploadUserProfileUseCase.uploadUserProfile(file)
        ResponseEntity.ok(result)
    } catch (e: Exception) {
        ResponseEntity.internalServerError().body("ν”„λ‘œν•„ μ—…λ‘œλ“œ 쀑 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: ${e.message}")
    }
}

이 κ°œμ„ λœ 버전은 더 λͺ…ν™•ν•œ λ©”μ„œλ“œ 이름을 μ‚¬μš©ν•˜κ³ , 기본적인 파일 μœ νš¨μ„± 검사와 였λ₯˜ 처리λ₯Ό ν¬ν•¨ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1)

19-19: @Transactional μ–΄λ…Έν…Œμ΄μ…˜μ˜ 적용 μœ„μΉ˜ 확인

@Transactional μ–΄λ…Έν…Œμ΄μ…˜μ„ 클래슀 λ ˆλ²¨μ— μ μš©ν•˜λ©΄ μ½”λ“œκ°€ 더 κΉ”λ”ν•΄μ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€. λ˜λŠ”, 읽기 μ „μš© νŠΈλžœμž­μ…˜κ³Ό μ“°κΈ° νŠΈλžœμž­μ…˜μ„ κ΅¬λΆ„ν•˜κΈ° μœ„ν•΄ λ©”μ†Œλ“œλ³„λ‘œ μ„ΈλΆ„ν™”ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

μ˜ˆμ‹œ:

+@Transactional
 @Service
 class UploadUserProfileService(
     // κΈ°μ‘΄ μ½”λ“œ μœ μ§€
 ) : UploadUserProfileUseCase {
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 333066d and 7635ff9.

πŸ“’ Files selected for processing (10)
  • src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/response/QueryMyApplicationResponse.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/attendance/service/ChangeAllAttendanceService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/meal/service/SaveMealService.kt (0 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/port/in/ModifyProfileUseCase.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/UserController.kt (3 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1 hunks)
πŸ’€ Files with no reviewable changes (1)
  • src/main/kotlin/dsm/pick2024/domain/meal/service/SaveMealService.kt
βœ… Files skipped from review due to trivial changes (1)
  • src/main/kotlin/dsm/pick2024/domain/attendance/service/ChangeAllAttendanceService.kt
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/kotlin/dsm/pick2024/domain/application/service/QueryMyApplicationService.kt
  • src/main/kotlin/dsm/pick2024/domain/user/domain/User.kt
  • src/main/kotlin/dsm/pick2024/domain/user/presentation/dto/response/QueryUserSimpleInfoResponse.kt
🧰 Additional context used
πŸ”‡ Additional comments (7)
src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/response/QueryMyApplicationResponse.kt (1)

13-13: ν”„λ‘œν•„ 속성 좔가에 λŒ€ν•œ κ²€ν† 

μƒˆλ‘œμš΄ profile: String? 속성이 QueryMyApplicationResponse 데이터 ν΄λž˜μŠ€μ— μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” PR의 λͺ©μ μΈ μ‚¬μš©μž ν”„λ‘œν•„ 이미지 μ—…λ‘œλ“œ κΈ°λŠ₯ κ΅¬ν˜„κ³Ό μΌμΉ˜ν•©λ‹ˆλ‹€.

고렀사항:

  1. 속성이 nullable(String?)둜 μ •μ˜λœ 것은 μ μ ˆν•΄ λ³΄μž…λ‹ˆλ‹€. λͺ¨λ“  μ‚¬μš©μžκ°€ ν”„λ‘œν•„ 이미지λ₯Ό 가지고 μžˆμ§€ μ•Šμ„ 수 있기 λ•Œλ¬Έμž…λ‹ˆλ‹€.
  2. 이 λ³€κ²½μœΌλ‘œ 인해 κΈ°μ‘΄ μ½”λ“œμ—μ„œ QueryMyApplicationResponseλ₯Ό μ‚¬μš©ν•˜λŠ” 뢀뢄에 영ν–₯이 μžˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€. κ΄€λ ¨ μ„œλΉ„μŠ€ 및 컨트둀러 μ½”λ“œλ₯Ό κ²€ν† ν•˜μ—¬ ν•„μš”ν•œ 경우 μ—…λ°μ΄νŠΈν•΄μ•Ό ν•©λ‹ˆλ‹€.

λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•˜μ—¬ QueryMyApplicationResponseλ₯Ό μ‚¬μš©ν•˜λŠ” λ‹€λ₯Έ νŒŒμΌλ“€μ„ ν™•μΈν•΄μ£Όμ„Έμš”:

src/main/kotlin/dsm/pick2024/domain/user/presentation/UserController.kt (2)

7-7: LGTM: μƒˆλ‘œμš΄ import 문이 μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

UploadUserProfileUseCaseλ₯Ό μœ„ν•œ import 문이 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μƒˆλ‘œμš΄ ν”„λ‘œν•„ μ—…λ‘œλ“œ κΈ°λŠ₯을 μœ„ν•΄ ν•„μš”ν•œ λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€.


32-33: LGTM: μƒμ„±μžμ— μƒˆλ‘œμš΄ μ˜μ‘΄μ„±μ΄ μ˜¬λ°”λ₯΄κ²Œ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

UploadUserProfileUseCaseκ°€ UserController의 μƒμ„±μžμ— 적절히 μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” 기쑴의 μ˜μ‘΄μ„± μ£Όμž… νŒ¨ν„΄μ„ λ”°λ₯΄κ³  있으며, μƒˆλ‘œμš΄ ν”„λ‘œν•„ μ—…λ‘œλ“œ κΈ°λŠ₯을 μœ„ν•΄ ν•„μš”ν•œ λ³€κ²½μ‚¬ν•­μž…λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/QueryUserSimpleInfoService.kt (3)

6-7: FileUtil 및 PathList import μΆ”κ°€κ°€ μ μ ˆν•©λ‹ˆλ‹€

'FileUtil'κ³Ό 'PathList'λ₯Ό importν•˜μ—¬ 파일 κ΄€λ ¨ κΈ°λŠ₯을 μ‚¬μš©ν•  수 있게 된 점이 μ’‹μŠ΅λ‹ˆλ‹€.


13-14: μƒμ„±μžμ— FileUtil μ˜μ‘΄μ„± μ£Όμž…

'fileUtil'을 μƒμ„±μžμ— μΆ”κ°€ν•˜μ—¬ μ˜μ‘΄μ„±μ„ μ£Όμž…ν•œ 방식이 μ μ ˆν•©λ‹ˆλ‹€. 이λ₯Ό 톡해 파일 μœ ν‹Έλ¦¬ν‹° κΈ°λŠ₯을 μ„œλΉ„μŠ€μ—μ„œ ν™œμš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.


20-26: μ‚¬μš©μž ν”„λ‘œν•„ 이미지 URL 생성 둜직 μΆ”κ°€

'QueryUserSimpleInfoResponse' 생성 μ‹œ 'user.profile'이 μ‘΄μž¬ν•  κ²½μš°μ—λ§Œ 'fileUtil.generateObjectUrl'을 μ‚¬μš©ν•˜μ—¬ ν”„λ‘œν•„ 이미지 URL을 μƒμ„±ν•˜λŠ” 둜직이 μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 'user.profile'이 null일 수 μžˆμœΌλ―€λ‘œ μ•ˆμ „ 호좜과 'let' ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ null μ•ˆμ „μ„±μ„ ν™•λ³΄ν•œ 점이 μ’‹μŠ΅λ‹ˆλ‹€.

src/main/kotlin/dsm/pick2024/domain/user/service/UploadUserProfileService.kt (1)

23-23: πŸ› οΈ Refactor suggestion

if 문을 let으둜 λ³€κ²½ν•˜μ—¬ μ½”λ“œ κ°„κ²°ν™”

기쑴의 if 문을 Kotlin의 let ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ 더 κ°„κ²°ν•˜κ³  읽기 μ‰½κ²Œ μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

@meltapplee meltapplee merged commit d60fa23 into develop Oct 16, 2024
1 check passed
@meltapplee meltapplee deleted the 252-upload-profile-api branch October 16, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

μœ μ € ν”„λ‘œν•„μ΄λ―Έμ§€
2 participants