-
Notifications
You must be signed in to change notification settings - Fork 4
refactor : project steps return index #295
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,11 +68,11 @@ public Project updateProject(Long id, PutProject.Request request) { | |
| } | ||
| } | ||
|
|
||
| Company customer = adminCompanyReader.getCompany(request.getCustomerId()); | ||
| Company developer = adminCompanyReader.getCompany(request.getDeveloperId()); | ||
| // Company customer = adminCompanyReader.getCompany(request.getCustomerId()); | ||
| // Company developer = adminCompanyReader.getCompany(request.getDeveloperId()); | ||
| ProjectType projectType = adminProjectTypeReader.getProjectType(request.getProjectTypeId()); | ||
|
|
||
| Project updatedProject = request.updateProject(project, customer, developer, projectType); | ||
| Project updatedProject = request.updateProject(project, projectType); | ||
| return adminProjectStore.store(updatedProject); | ||
| } | ||
|
|
||
|
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. 코드 패치에 대한 간단한 코드 리뷰를 진행하겠습니다. 주요 변경 사항:
잠재적인 버그 위험:
개선 제안:
이러한 점들을 반영하면 코드의 안정성과 가독성을 높일 수 있습니다. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,14 +124,10 @@ public Project update( | |
| LocalDate startDate, | ||
| LocalDate endDate, | ||
| LocalDateTime approvalDate, | ||
| Company customer, | ||
| Company developer, | ||
| ProjectType ProjectType, | ||
| String bnsManager | ||
| ) { | ||
| this.projectName = name; | ||
| this.customer = customer; | ||
| this.developer = developer; | ||
| this.projectDescription = description; | ||
| this.projectType = ProjectType; | ||
| this.projectStatusCode = statusCode; | ||
|
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. 코드 패치에 대해 간단한 리뷰를 하겠습니다.
위의 사항들을 고려하여 수정하면 코드의 품질과 안정성을 높일 수 있을 것입니다. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| @Getter | ||
| @AllArgsConstructor | ||
| public enum MemberType { | ||
| ADMIN("admin"), | ||
| ADMIN("ADMIN"), | ||
| CLIENT("client"), | ||
| DEVELOPER("developer"); | ||
|
|
||
|
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. 코드 패치에 대한 간단한 리뷰입니다.
종합적으로 보았을 때 이 변경은 긍정적이지만, 기존 코드와의 호환성 체크 및 코드 문서화에 유의해야 할 필요가 있습니다. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class GetProjectStep { | ||
|
|
@@ -16,7 +17,7 @@ public class GetProjectStep { | |
| @NoArgsConstructor | ||
| public static class Response { | ||
| private Long projectId; | ||
| private List<ProjectStepInfo> projectStepInfo; | ||
| private List<ProjectStepInfo> projectStepInfo = new ArrayList<>(); | ||
|
|
||
| @Override | ||
| public String toString() { | ||
|
|
@@ -25,9 +26,17 @@ public String toString() { | |
| '}'; | ||
| } | ||
|
|
||
| public Response(Long projectId, List<ProjectStepInfo> projectStepInfo) { | ||
| private Response(Long projectId) { | ||
| this.projectId = projectId; | ||
| this.projectStepInfo = projectStepInfo; | ||
| this.projectStepInfo = new ArrayList<>(); | ||
| } | ||
|
|
||
| public static Response create(Long projectId) { | ||
| return new Response(projectId); | ||
| } | ||
|
|
||
| public void add(ProjectStep projectStep, List<Checklist> checklists) { | ||
| projectStepInfo.add(ProjectStepInfo.toDto(projectStep, projectStepInfo.size() + 1, checklists)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -46,15 +55,15 @@ public String toString() { | |
| '}'; | ||
| } | ||
|
|
||
| private ProjectStepInfo(ProjectStep projectStep, List<Checklist> projectChecklist) { | ||
| private ProjectStepInfo(ProjectStep projectStep, Integer order, List<Checklist> projectChecklist) { | ||
| stepId = projectStep.getId(); | ||
| stepName = projectStep.getStepName(); | ||
| stepOrder = projectStep.getStepOrder(); | ||
| stepOrder = order; | ||
| this.projectChecklist = projectChecklist.stream().map(ProjectChecklist::new).toList(); | ||
| } | ||
|
|
||
| public static ProjectStepInfo toDto(ProjectStep projectStep, List<Checklist> projectChecklist) { | ||
| return new ProjectStepInfo(projectStep, projectChecklist); | ||
| public static ProjectStepInfo toDto(ProjectStep projectStep, Integer order, List<Checklist> projectChecklist) { | ||
| return new ProjectStepInfo(projectStep, order, projectChecklist); | ||
| } | ||
| } | ||
|
|
||
|
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. 코드 리뷰에 대해 몇 가지 피드백을 드리겠습니다.
결론적으로, 이 코드 패치는 기본적인 의도는 명확하지만, 입력 값에 대한 유효성 검사 및 예외 처리를 보완하면 더욱 안전하고 견고한 코드가 될 것입니다. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,15 +39,13 @@ public GetStepChecklist.Response getStepChecklist(Long stepId) { | |
| public GetProjectStep.Response getProjectStep(Long projectId) { | ||
| List<ProjectStep> projectSteps = stepReader.getProjectStep(projectId); | ||
|
|
||
| List<GetProjectStep.ProjectStepInfo> projectStepInfos = projectSteps.stream().map(stepInfo -> { | ||
| List<Checklist> checklists = checklistReader.read(stepInfo.getId()); | ||
| return GetProjectStep.ProjectStepInfo.toDto( | ||
| stepInfo, | ||
| checklists | ||
| ); | ||
| }).toList(); | ||
|
|
||
| return new GetProjectStep.Response(projectId, projectStepInfos); | ||
| GetProjectStep.Response response = GetProjectStep.Response.create(projectId); | ||
|
|
||
| projectSteps.forEach(stepInfo -> { | ||
| response.add(stepInfo, checklistReader.read(stepInfo.getId())); | ||
| }); | ||
|
|
||
| return response; | ||
| } | ||
|
Comment on lines
+42
to
49
Collaborator
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. |
||
|
|
||
| @Override | ||
|
|
||

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.
코드 패치에 대한 리뷰를 진행하겠습니다. 전반적으로 코드를 간결하게 작성하려고 한 점은 긍정적입니다. 그러나 몇 가지 주의해야 할 사항과 개선할 수 있는 점들이 있습니다.
삭제된 매개변수 확인:
Company customer와Company developer매개변수가 삭제되었습니다. 이 두 개체가update메서드에서 필요하지 않다면, 메서드에 대한 호출에서도 이 매개변수들이 제거되었는지 확인이 필요합니다. 그렇지 않으면 호출부에서 오류가 발생할 수 있습니다.Null 체크:
update메서드 내에서startDate,endDate,finalApprovalDate,bnsManager등의 값이 null인지 여부를 체크하는 로직이 필요할 수 있습니다. 특히 이러한 값들이 데이터베이스에 저장된 경우, null 값을 허용하지 않는 경우도 있으므로 오류가 발생할 수 있습니다.테스트 커버리지: 이 변경 사항과 관련된 테스트 케이스가 충분한지 확인해야 합니다. 특히 매개변수가 삭제된 부분과 관련하여 기존의 기능이 정상적으로 작동하는지를 검증할 필요가 있습니다.
주석 추가: 코드의 변경 이유에 대한 주석을 추가하는 것도 좋습니다. 이는 다른 개발자들이 변경 사항을 이해하는 데 큰 도움이 됩니다.
코드 스타일: 코드 포매팅을 일관되게 유지하는 것이 좋습니다. 예를 들어, 각 메서드와 매개변수 간의 공백이 일관되게 유지된다면 가독성이 향상됩니다.
이러한 점들을 고려하여 코드를 개선해 나가면 더욱 안정적인 결과를 얻을 수 있을 것입니다.