-
Notifications
You must be signed in to change notification settings - Fork 4
refactor : file exist add #305
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,9 @@ public PaginatedResponse<PostListResponse> selectPosts(Boolean isAllStages, Long | |
| } else { | ||
| repoPostList = postReader.getPostsByProjectStepId(projectStepId, keyword, repoFilter, PageRequest.of(page, PAGE_SIZE, getSort(isAllStages, sortType))); | ||
| } | ||
| repoPostList.getContent().forEach(post -> | ||
| post.setFileExist(!postFileService.getPostFiles(post.getPostId()).isEmpty()) | ||
| ); | ||
|
|
||
| return PaginatedResponse.createPaginatedResponse(repoPostList); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코드 리뷰 결과는 다음과 같습니다:
종합적으로 이러한 사항들을 고려하여 코드를 개선하면, 더 나은 성능과 안정성을 기대할 수 있을 것입니다. |
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드 리뷰를 진행하겠습니다. 이 패치에서 몇 가지 중요한 사항과 개선할 점이 있습니다.
변수 이름의 일관성:
fileExists변수는 불리언 값을 나타내며 존재 여부를 나타내는 데 사용됩니다. 그러나 이 변수의 Getter 메소드가 없기 때문에 외부에서 이 정보에 접근할 수 없습니다. Getter 메소드를 추가하는 것이 좋습니다.Boolean과 boolean의 사용:
fileExists는Boolean타입으로 정의되어 있습니다. 이는 null 값도 가질 수 있지만, 존재 여부만 체크하는 경우boolean타입으로 사용하는 것이 더 안전하며, 불필요한 null 체크를 피할 수 있습니다.기본값 설정: 생성자에서
this.fileExists를false로 초기화하는 것은 좋은 접근입니다. 그러나 이는 해당 정보가 항상 미리 설정된다고 가정하고 있기 때문에, 상황에 따라 상황에 맞는 값으로 초기화할 필요성이 있을 수 있습니다. 생성자를 통해 파일 존재 여부를 매개변수로 받아 초기화하는 것도 고려해 볼 수 있습니다.주석 추가: 존재 여부를 뜻하는
fileExists필드에 대한 설명이나 필요한 처리를 주석으로 추가하는 것이 코드의 가독성을 높이는 데 도움이 될 것입니다.메소드 이름 수정 제안:
setFileExist메소드는setFileExists로 이름을 변경하는 것이 좋습니다. 메소드 이름과 변수 이름의 일관성을 유지하면 코드의 이해도를 높일 수 있습니다.정상 작동 여부 검증: fileExists의 값을 설정할 때, valid 상태(예: 파일이 실제로 존재하는지)의 체크가 필요한 경우가 있을 수 있습니다. 적절한 예외 처리나 검증 로직을 추가하는 것이 좋습니다.
이러한 점들을 고려해 보시고, 코드의 안정성과 가독성을 높이는 방안에 대해 한 번 더 점검해 보시기 바랍니다.