Skip to content

Conversation

@parkuiery
Copy link
Member

@parkuiery parkuiery commented Nov 19, 2024

κ°œμš”

곡지사항 μƒμ„Έμ—μ„œ μ²¨λΆ€νŒŒμΌμ„ nullable 처리 ν•©λ‹ˆλ‹€.

μž‘μ—… λ‚΄μš©

ν•  말

μ—†μŒ

Summary by CodeRabbit

  • New Features

    • attachments 속성이 μ„ νƒμ μœΌλ‘œ λ³€κ²½λ˜μ–΄ null 값을 ν—ˆμš©ν•©λ‹ˆλ‹€.
    • UIμ—μ„œ attachmentsλ₯Ό μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬ν•˜μ—¬ μ•ˆμ •μ„±μ„ ν–₯μƒμ‹œμΌ°μŠ΅λ‹ˆλ‹€.
  • Bug Fixes

    • 파일 μ €μž₯ λ‘œμ§μ„ μˆ˜μ •ν•˜μ—¬ 디렉토리 쑴재 μ—¬λΆ€λ₯Ό ν™•μΈν•˜κ³  μ˜¬λ°”λ₯΄κ²Œ μ²˜λ¦¬ν•©λ‹ˆλ‹€.

@parkuiery parkuiery added the λ¦¬νŒ©ν† λ§ μ½”λ“œλ₯Ό λ¦¬νŒ©ν† λ§ ν•©λ‹ˆλ‹€. label Nov 19, 2024
@parkuiery parkuiery self-assigned this Nov 19, 2024
@parkuiery parkuiery requested a review from a team as a code owner November 19, 2024 03:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2024

Walkthrough

이 λ³€κ²½ 사항은 NoticeDetailsEntity와 FetchNoticeDetailsResponse 데이터 클래슀의 attachments 속성을 λΉ„μ–΄ μžˆμ„ 수 μžˆλŠ”(nullable) 리슀트둜 μˆ˜μ •ν•˜λŠ” 것을 ν¬ν•¨ν•©λ‹ˆλ‹€. 이둜 인해 attachments ν•„λ“œλŠ” 이제 null 값을 κ°€μ§ˆ 수 있으며, κ΄€λ ¨ λ³€ν™˜ ν•¨μˆ˜μ™€ UI ꡬ성 μš”μ†Œμ—μ„œ 이 λ³€κ²½ 사항을 μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬ν•˜λ„λ‘ μ—…λ°μ΄νŠΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ΄λŸ¬ν•œ μˆ˜μ •μ€ UI와 데이터 λͺ¨λΈ κ°„μ˜ μƒν˜Έμž‘μš©μ„ 보닀 μœ μ—°ν•˜κ²Œ λ§Œλ“­λ‹ˆλ‹€.

Changes

파일 경둜 λ³€κ²½ μš”μ•½
core/domain/src/main/java/team/retum/usecase/entity/notice/NoticeDetailsEntity.kt NoticeDetailsEntity의 attachments 속성을 List<AttachmentEntity>μ—μ„œ List<AttachmentEntity>?둜 λ³€κ²½.
core/network/src/main/java/team/retum/network/model/response/notice/FetchNoticeDetailsResponse.kt FetchNoticeDetailsResponse의 attachments 속성을 List<AttachmentResponse>μ—μ„œ List<AttachmentResponse>?둜 λ³€κ²½.
feature/notice/src/main/java/team/retum/jobis/notice/ui/NoticeDetailsScreen.kt attachments 속성에 λŒ€ν•œ null μ•ˆμ „μ„± 검사λ₯Ό μΆ”κ°€ν•˜μ—¬ μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬ν•˜λ„λ‘ λ³€κ²½.
feature/notice/src/main/java/team/retum/jobis/notice/viewmodel/NoticeDetailsViewModel.kt NoticeDetailsState의 attachments 속성을 emptyList()μ—μ„œ null둜 λ³€κ²½ν•˜κ³ , 파일 μ €μž₯ 둜직 μˆ˜μ •.

Possibly related issues

Possibly related PRs

  • πŸ”— :: (#419) nullable 처리 #420: RecruitmentDetailsEntity와 FetchRecruitmentDetailsResponse의 속성을 nullable νƒ€μž…μœΌλ‘œ λ³€κ²½ν•˜λŠ” μˆ˜μ •μœΌλ‘œ, λ³Έ PR의 λ³€κ²½ 사항과 μœ μ‚¬ν•©λ‹ˆλ‹€.

Suggested reviewers

  • Tmdhoon2

Poem

🐰
μ²¨λΆ€νŒŒμΌμ΄ 없을 μˆ˜λ„,
우리의 곡지사항이 λ”μš± μžμœ λ‘œμ›Œμš”.
μ•ˆμ „ν•˜κ²Œ 닀루고,
UIλŠ” λ”μš± λΉ›λ‚˜μ£ .
λ³€ν™”μ˜ λ°”λžŒ 속에,
μƒˆλ‘œμš΄ μ‹œμž‘μ„ λ…Έλž˜ν•΄μš”! 🌼


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
Contributor

@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 (3)
feature/notice/src/main/java/team/retum/jobis/notice/viewmodel/NoticeDetailsViewModel.kt (2)

Line range hint 63-67: 디렉토리 생성 λ‘œμ§μ— 였λ₯˜κ°€ μžˆμŠ΅λ‹ˆλ‹€.

ν˜„μž¬ μ½”λ“œλŠ” 디렉토리λ₯Ό 파일둜 μƒμ„±ν•˜λ €κ³  μ‹œλ„ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. createNewFile()은 파일 생성에 μ‚¬μš©λ˜λ©°, 디렉토리 μƒμ„±μ—λŠ” μ μ ˆν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

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

val directory = File(dir)
if (!directory.exists()) {
-    directory.createNewFile()
+    directory.mkdirs()
}

Line range hint 58-60: μ™ΈλΆ€ μ €μž₯μ†Œ μ ‘κ·Ό μ‹œ null 체크가 ν•„μš”ν•©λ‹ˆλ‹€.

getExternalFilesDir()은 null을 λ°˜ν™˜ν•  수 μžˆμœΌλ―€λ‘œ, μ•ˆμ „ν•œ μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

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

- val dir = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
-     .toString() + destinationPath
+ val externalDir = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
+     ?: throw IllegalStateException("μ™ΈλΆ€ μ €μž₯μ†Œμ— μ ‘κ·Όν•  수 μ—†μŠ΅λ‹ˆλ‹€")
+ val dir = externalDir.toString() + destinationPath
feature/notice/src/main/java/team/retum/jobis/notice/ui/NoticeDetailsScreen.kt (1)

Line range hint 122-126: 첨뢀 파일 nullable μ²˜λ¦¬κ°€ 적절히 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ•ˆμ „ν•œ null 처리λ₯Ό μœ„ν•΄ safe-call μ—°μ‚°μž(?.)λ₯Ό μ‚¬μš©ν•œ 것이 μ’‹μŠ΅λ‹ˆλ‹€. ν•˜μ§€λ§Œ 첨뢀 파일이 μ—†λŠ” κ²½μš°μ— λŒ€ν•œ UI 처리λ₯Ό κ°œμ„ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 첨뢀 파일이 μ—†λŠ” κ²½μš°μ— λŒ€ν•œ UI 처리λ₯Ό μΆ”κ°€ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”:

-            state.noticeDetailsEntity.attachments?.forEach {
-                AttachFile(
-                    fileName = it.url,
-                    saveFileData = saveFileData,
-                )
-            }
+            state.noticeDetailsEntity.attachments?.let { attachments ->
+                if (attachments.isEmpty()) {
+                    JobisText(
+                        text = stringResource(id = R.string.no_attachments),
+                        style = JobisTypography.Description,
+                        color = JobisTheme.colors.onSurfaceVariant,
+                    )
+                } else {
+                    attachments.forEach {
+                        AttachFile(
+                            fileName = it.url,
+                            saveFileData = saveFileData,
+                        )
+                    }
+                }
+            }
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between cac2fd2 and 2ff6051.

πŸ“’ Files selected for processing (4)
  • core/domain/src/main/java/team/retum/usecase/entity/notice/NoticeDetailsEntity.kt (2 hunks)
  • core/network/src/main/java/team/retum/network/model/response/notice/FetchNoticeDetailsResponse.kt (1 hunks)
  • feature/notice/src/main/java/team/retum/jobis/notice/ui/NoticeDetailsScreen.kt (1 hunks)
  • feature/notice/src/main/java/team/retum/jobis/notice/viewmodel/NoticeDetailsViewModel.kt (1 hunks)
πŸ”‡ Additional comments (3)
core/network/src/main/java/team/retum/network/model/response/notice/FetchNoticeDetailsResponse.kt (1)

12-12: nullable μ²˜λ¦¬κ°€ μ˜¬λ°”λ₯΄κ²Œ κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

변경사항이 μš”κ΅¬μ‚¬ν•­μ— 맞게 잘 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€. attachments ν•„λ“œλ₯Ό nullable둜 λ§Œλ“œλŠ” 것은 μ²¨λΆ€νŒŒμΌμ΄ μ—†λŠ” 곡지사항을 μ²˜λ¦¬ν•˜λŠ”λ° μ μ ˆν•œ λ°©λ²•μž…λ‹ˆλ‹€.

UI λ ˆμ΄μ–΄μ—μ„œ null μ²˜λ¦¬κ°€ μ œλŒ€λ‘œ λ˜μ–΄μžˆλŠ”μ§€ ν™•μΈν•˜κΈ° μœ„ν•΄ λ‹€μŒ 슀크립트λ₯Ό μ‹€ν–‰ν•΄λ³΄μ„Έμš”:

βœ… Verification successful

Let me check the UI layer implementation more thoroughly with additional scripts.


UI λ ˆμ΄μ–΄μ˜ null μ²˜λ¦¬κ°€ μ μ ˆν•˜κ²Œ κ΅¬ν˜„λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

NoticeDetailsScreen의 κ΅¬ν˜„μ„ ν™•μΈν•œ κ²°κ³Ό, attachments ν•„λ“œμ˜ null μ²˜λ¦¬κ°€ μ•ˆμ „ν•˜κ²Œ λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€:

  • state.noticeDetailsEntity.attachments?.forEach와 같이 safe call μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•˜μ—¬ null μ•ˆμ „μ„±μ„ 보μž₯ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
  • μ²¨λΆ€νŒŒμΌμ΄ μ—†λŠ” κ²½μš°μ—λ„ UIκ°€ μ •μƒμ μœΌλ‘œ λ™μž‘ν•  κ²ƒμœΌλ‘œ μ˜ˆμƒλ©λ‹ˆλ‹€.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: UI λ ˆμ΄μ–΄μ—μ„œ attachments null 체크 검증

# attachments μ ‘κ·Ό κ΄€λ ¨ μ½”λ“œ 검색
rg -t kotlin "\.attachments" 

# null μ•ˆμ „μ„± 검사 ꡬ문 검색
ast-grep --pattern 'if ($expr?.attachments != null) { $$$ }'

Length of output: 646


Script:

#!/bin/bash
# NoticeDetailsScreen의 κ΅¬ν˜„ 확인
cat feature/notice/src/main/java/team/retum/jobis/notice/ui/NoticeDetailsScreen.kt

# attachments κ΄€λ ¨ null 처리 νŒ¨ν„΄ μΆ”κ°€ 검색
ast-grep --pattern '$expr?.attachments?.forEach'
ast-grep --pattern '$expr?.attachments?.map'

# attachmentsκ°€ μ‚¬μš©λ˜λŠ” λ‹€λ₯Έ νŒ¨ν„΄ 검색
ast-grep --pattern '$expr.attachments'

Length of output: 7429

core/domain/src/main/java/team/retum/usecase/entity/notice/NoticeDetailsEntity.kt (1)

14-14: 첨뢀 파일 ν•„λ“œμ˜ Nullable μ²˜λ¦¬κ°€ 적절히 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

데이터 ν΄λž˜μŠ€μ—μ„œ attachments ν•„λ“œλ₯Ό nullable둜 λ³€κ²½ν•œ 것이 PR의 λͺ©μ μ— λΆ€ν•©ν•©λ‹ˆλ‹€.

feature/notice/src/main/java/team/retum/jobis/notice/viewmodel/NoticeDetailsViewModel.kt (1)

101-101: LGTM! attachmentsλ₯Ό nullable둜 λ³€κ²½ν•œ 것이 μ μ ˆν•©λ‹ˆλ‹€.

곡지사항에 μ²¨λΆ€νŒŒμΌμ΄ μ—†λŠ” 경우λ₯Ό λͺ…ν™•ν•˜κ²Œ ν‘œν˜„ν•  수 있게 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

content = this.content,
createdAt = outputFormat.format(inputFormat.parse(this.createdAt)!!),
attachments = this.attachments.map { it.toEntity() },
attachments = this.attachments?.map { it.toEntity() },
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ’‘ Codebase verification

Null μ•ˆμ „μ„± κ΄€λ ¨ μ΄μŠˆκ°€ λ°œκ²¬λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

CompanyDetailsEntityμ—μ„œλŠ” attachmentsκ°€ nullable (List<String>?)둜 μ •μ˜λ˜μ–΄ μžˆμ–΄ safe call μ²˜λ¦¬κ°€ ν•„μš”ν•˜μ§€λ§Œ, AppliedCompaniesEntity의 ApplicationEntityμ—μ„œλŠ” attachmentsκ°€ non-null (List<AttachmentEntity>)둜 μ •μ˜λ˜μ–΄ μžˆμŒμ—λ„ λΆˆκ΅¬ν•˜κ³  non-null νƒ€μž…μ— λŒ€ν•΄ 직접 μ ‘κ·Όν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

  • core/domain/src/main/java/team/retum/usecase/entity/application/AppliedCompaniesEntity.kt: attachments = this.attachments.map { it.toEntity() } 뢀뢄은 이미 non-nullμ΄λ―€λ‘œ safe call μ—°μ‚°μžκ°€ ν•„μš”ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
  • core/domain/src/main/java/team/retum/usecase/entity/company/CompanyDetailsEntity.kt: attachments = this.attachments 뢀뢄은 nullable νƒ€μž…μ΄λ―€λ‘œ safe call μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•΄μ•Ό ν•©λ‹ˆλ‹€.
πŸ”— Analysis chain

μ•ˆμ „ν•œ null μ²˜λ¦¬κ°€ 잘 κ΅¬ν˜„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

safe call μ—°μ‚°μž(?.)λ₯Ό μ‚¬μš©ν•˜μ—¬ attachmentsκ°€ null일 경우λ₯Ό 적절히 μ²˜λ¦¬ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” Kotlin의 null μ•ˆμ „μ„± κΈ°λŠ₯을 잘 ν™œμš©ν•œ μ˜ˆμ‹œμž…λ‹ˆλ‹€.

λ‹€λ§Œ, λ‹€μŒ 사항을 확인해 μ£Όμ‹œλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: attachments ν•„λ“œλ₯Ό μ‚¬μš©ν•˜λŠ” λ‹€λ₯Έ 뢀뢄듀이 null 처리λ₯Ό 적절히 ν•˜κ³  μžˆλŠ”μ§€ 확인

# attachments ν•„λ“œ μ‚¬μš© 검색
rg -t kotlin "\.attachments[^?]" 

Length of output: 306


Script:

#!/bin/bash
# Let's check the full context of these files to understand the attachments field usage

echo "=== CompanyDetailsEntity.kt ==="
rg -A 5 -B 5 "\.attachments[^?]" core/domain/src/main/java/team/retum/usecase/entity/company/CompanyDetailsEntity.kt

echo -e "\n=== AppliedCompaniesEntity.kt ==="
rg -A 5 -B 5 "\.attachments[^?]" core/domain/src/main/java/team/retum/usecase/entity/application/AppliedCompaniesEntity.kt

# Also check the type definitions
echo -e "\n=== Searching for attachments property declarations ==="
ast-grep --pattern 'val attachments'

Length of output: 1437


Script:

#!/bin/bash
# Let's check the type definitions of these classes to understand if attachments is nullable

echo "=== CompanyDetailsEntity class definition ==="
rg -A 20 "class CompanyDetailsEntity" core/domain/src/main/java/team/retum/usecase/entity/company/CompanyDetailsEntity.kt

echo -e "\n=== AppliedCompaniesEntity class definition ==="
rg -A 20 "class AppliedCompaniesEntity" core/domain/src/main/java/team/retum/usecase/entity/application/AppliedCompaniesEntity.kt

Length of output: 1727

@parkuiery parkuiery merged commit 391f7af into develop Nov 19, 2024
2 checks passed
@parkuiery parkuiery deleted the feature/442-곡지사항-μ²¨λΆ€νŒŒμΌ-nullable-처리 branch November 19, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

λ¦¬νŒ©ν† λ§ μ½”λ“œλ₯Ό λ¦¬νŒ©ν† λ§ ν•©λ‹ˆλ‹€.

Projects

Development

Successfully merging this pull request may close these issues.

곡지사항 μ²¨λΆ€νŒŒμΌ nullable 처리

3 participants