-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor/put project #297
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
Refactor/put project #297
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 |
|---|---|---|
|
|
@@ -29,7 +29,6 @@ public static class Request { | |
| private Long projectTypeId; // 프로젝트 유형 ID | ||
| private ProjectStatusCode projectStatusCode; // | ||
| private String bnsManager; // BNS 담당자 ID (Member 엔티티의 ID) | ||
| private String contractNumber; // 계약서 번호 | ||
| private LocalDate plannedStartDate; // 시작 예정일 | ||
| private LocalDate plannedEndDate; // 종료 예정일 | ||
| private LocalDate startDate; // 시작일 | ||
|
|
@@ -54,7 +53,6 @@ public Project updateProject( | |
| projectName, | ||
| projectDescription, | ||
| projectStatusCode, | ||
| contractNumber, | ||
| plannedStartDate, | ||
| plannedEndDate, | ||
| startDate, | ||
|
|
@@ -76,7 +74,6 @@ public static class Response { | |
| private String projectType; // 프로젝트 유형 ID | ||
| private ProjectStatusCode projectStatusCode; // | ||
| private String bnsManager; // BNS 담당자 ID (Member 엔티티의 ID) | ||
| private String contractNumber; // 계약서 번호 | ||
| private LocalDate plannedStartDate; // 시작 예정일 | ||
| private LocalDate plannedEndDate; // 종료 예정일 | ||
| private LocalDate startDate; // 시작일 | ||
|
|
@@ -101,7 +98,6 @@ private Response(Project project, List<ProjectTag> tags, List<ProjectAuthorizati | |
| projectDescription = project.getProjectDescription(); | ||
| projectType = project.getProjectType().getProjectTypeName(); | ||
| bnsManager = project.getBnsManager(); | ||
| contractNumber = project.getContractNumber(); | ||
| plannedStartDate = project.getPlannedStartDate(); | ||
| plannedEndDate = project.getPlannedEndDate(); | ||
| startDate = project.getStartDate(); // 시작일 | ||
|
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 |
|---|---|---|
|
|
@@ -10,4 +10,6 @@ | |
| @Repository | ||
| public interface AdminProjectTagRepository extends JpaRepository<ProjectTag, Long> { | ||
| List<ProjectTag> findByProjectIdAndIsActive(Long projectId, YesNo isActive); | ||
|
|
||
|
|
||
| } | ||
|
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 |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| public class AdminProjectTagServiceImpl implements AdminProjectTagService { | ||
|
|
||
| private final ProjectTagReader projectTagReader; | ||
| private final AdminProjectTagStore adminProjectTagStore; | ||
| private final AdminProjectTagStore projectTagStore; | ||
|
|
||
| @Override | ||
| public List<ProjectTag> getAllProjectTags(Long projectId) { | ||
|
|
@@ -21,6 +21,7 @@ public List<ProjectTag> getAllProjectTags(Long projectId) { | |
|
|
||
| @Override | ||
| public List<ProjectTag> storeProjectTags(Project project, List<String> tags) { | ||
| return adminProjectTagStore.store(project, tags); | ||
| List<ProjectTag> projectTags = projectTagReader.readByProjectId(project.getId()); | ||
| return projectTagStore.store(project, tags, projectTags); | ||
| } | ||
| } | ||
|
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,5 +6,5 @@ | |
| import java.util.List; | ||
|
|
||
| public interface AdminProjectTagStore { | ||
| List<ProjectTag> store(Project project, List<String> tags); | ||
| List<ProjectTag> store(Project project, List<String> tags, List<ProjectTag> projectTags); | ||
| } | ||
|
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 |
|---|---|---|
|
|
@@ -15,11 +15,14 @@ public class AdminProjectTagStoreImpl implements AdminProjectTagStore { | |
| private final AdminProjectTagRepository projectTagRepository; | ||
|
|
||
| @Override | ||
| public List<ProjectTag> store(Project project, List<String> tagNameList) { | ||
| public List<ProjectTag> store(Project project, List<String> tagNameList, List<ProjectTag> projectTags) { | ||
| if(tagNameList == null || tagNameList.isEmpty()) { | ||
| return List.of(); | ||
| return projectTags; | ||
| } | ||
|
|
||
| // TODO - 리스트 확인 후 추가 및 삭제 처리 | ||
| projectTagRepository.deleteAll(projectTags); | ||
|
|
||
| List<ProjectTag> ProjectTags = tagNameList | ||
| .stream() | ||
| .map(tagName -> ProjectTag.create(project, tagName)) | ||
|
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. 코드 리뷰 결과입니다:
이러한 점들을 고려하여 코드를 리팩토링하면 안정성과 유지보수성을 높일 수 있을 것입니다. |
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,7 +118,6 @@ public Project update( | |
| String name, | ||
| String description, | ||
| ProjectStatusCode statusCode, | ||
| String contractNumber, | ||
| LocalDate plannedStartDate, | ||
| LocalDate plannedEndDate, | ||
| LocalDate startDate, | ||
|
|
@@ -132,7 +131,6 @@ public Project update( | |
| this.projectType = ProjectType; | ||
| this.projectStatusCode = statusCode; | ||
| this.bnsManager = bnsManager; | ||
| this.contractNumber = contractNumber; | ||
| this.plannedStartDate = plannedStartDate; | ||
| this.plannedEndDate = plannedEndDate; | ||
| this.startDate = startDate; | ||
|
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 |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import com.seveneleven.entity.global.YesNo; | ||
| import com.seveneleven.entity.global.converter.YesNoConverter; | ||
| import com.seveneleven.entity.member.Member; | ||
| import com.seveneleven.entity.project.constant.Authorization; | ||
| import com.seveneleven.entity.project.constant.MemberType; | ||
| import com.seveneleven.entity.project.duplkey.MemberProjectStepId; | ||
| import jakarta.persistence.*; | ||
|
|
@@ -34,12 +35,13 @@ public class ProjectAuthorization extends BaseEntity { | |
| private MemberType memberType; // 회원 구분 (client, developer) | ||
|
|
||
| // Question - Enum으로 뺄까? | ||
| private String authorizationCode; // 권한 코드 | ||
| @Enumerated(EnumType.STRING) | ||
| private Authorization authorizationCode; // 권한 코드 | ||
|
|
||
| @Convert(converter = YesNoConverter.class) | ||
| private YesNo isActive; // 삭제 여부 | ||
|
|
||
| private ProjectAuthorization(Member member, Project project, MemberType memberType, String authorizationCode) { | ||
| private ProjectAuthorization(Member member, Project project, MemberType memberType, Authorization authorizationCode) { | ||
| this.id = new MemberProjectStepId(member.getId(), project.getId()); | ||
| this.member = member; | ||
| this.project = project; | ||
|
|
@@ -48,11 +50,11 @@ private ProjectAuthorization(Member member, Project project, MemberType memberTy | |
| this.isActive = YesNo.YES; | ||
| } | ||
|
|
||
| public static ProjectAuthorization create(Member member, Project project, MemberType memberType, String authorizationCode) { | ||
| public static ProjectAuthorization create(Member member, Project project, MemberType memberType, Authorization authorizationCode) { | ||
| return new ProjectAuthorization(member, project, memberType, authorizationCode); | ||
| } | ||
|
|
||
| public void edit(MemberType memberType, String authorizationCode) { | ||
| public void edit(MemberType memberType, Authorization authorizationCode) { | ||
| this.memberType = memberType; | ||
| this.authorizationCode = authorizationCode; | ||
| } | ||
|
|
@@ -61,4 +63,8 @@ public ProjectAuthorizationHistory delete() { | |
| isActive = YesNo.NO; | ||
| return ProjectAuthorizationHistory.create(this); | ||
| } | ||
|
|
||
| public String getAuthorization() { | ||
| return authorizationCode.name(); | ||
| } | ||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ private ProjectAuthorizationHistory(ProjectAuthorization authorization) { | |
| this.memberName = authorization.getMember().getName(); | ||
| this.projectName = authorization.getProject().getProjectName(); | ||
| this.memberType = authorization.getMemberType().name(); | ||
| this.authorizationCode = authorization.getAuthorizationCode(); | ||
| this.authorizationCode = authorization.getAuthorization(); | ||
| this.isActive = authorization.getIsActive(); | ||
| } | ||
|
|
||
|
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 |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ public String toString() { | |
|
|
||
| private Response(ProjectAuthorization authorization) { | ||
| this.memberId = authorization.getMember().getId(); | ||
| this.authorization = authorization.getAuthorizationCode(); | ||
| this.authorization = authorization.getAuthorization(); | ||
| this.memberType = authorization.getMemberType(); | ||
| } | ||
|
|
||
|
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 |
|---|---|---|
|
|
@@ -58,7 +58,7 @@ public String toString() { | |
| private CustomerMemberAuthorization(ProjectAuthorization projectAuthorization) { | ||
| this.memberId = projectAuthorization.getMember().getId(); | ||
| this.memberName = projectAuthorization.getMember().getName(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorizationCode(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorization(); | ||
| } | ||
|
|
||
| public static CustomerMemberAuthorization toDto(ProjectAuthorization projectAuthorization) { | ||
|
|
@@ -82,7 +82,7 @@ public String toString() { | |
| private DeveloperMemberAuthorization(ProjectAuthorization projectAuthorization) { | ||
| this.memberId = projectAuthorization.getMember().getId(); | ||
| this.memberName = projectAuthorization.getMember().getName(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorizationCode(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorization(); | ||
| } | ||
|
|
||
| public static DeveloperMemberAuthorization toDto(ProjectAuthorization projectAuthorization) { | ||
|
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 |
|---|---|---|
|
|
@@ -110,7 +110,7 @@ private CustomerMemberAuthorization(ProjectAuthorization projectAuthorization) { | |
| this.memberName = projectAuthorization.getMember().getName(); | ||
| this.department = projectAuthorization.getMember().getDepartment(); | ||
| this.position = projectAuthorization.getMember().getPosition(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorizationCode(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorization(); | ||
| } | ||
|
|
||
| public static CustomerMemberAuthorization toDto(ProjectAuthorization projectAuthorization) { | ||
|
|
@@ -138,7 +138,7 @@ private DeveloperMemberAuthorization(ProjectAuthorization projectAuthorization) | |
| this.memberName = projectAuthorization.getMember().getName(); | ||
| this.department = projectAuthorization.getMember().getDepartment(); | ||
| this.position = projectAuthorization.getMember().getPosition(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorizationCode(); | ||
| this.projectAuthorization = projectAuthorization.getAuthorization(); | ||
| } | ||
|
|
||
| public static DeveloperMemberAuthorization toDto(ProjectAuthorization projectAuthorization) { | ||
|
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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import com.seveneleven.entity.member.Member; | ||
| import com.seveneleven.entity.project.Project; | ||
| import com.seveneleven.entity.project.ProjectAuthorization; | ||
| import com.seveneleven.entity.project.constant.Authorization; | ||
| import com.seveneleven.entity.project.constant.MemberType; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
@@ -30,7 +31,7 @@ public interface MemberAuthorization { | |
| public static abstract class BaseMemberAuthorization implements MemberAuthorization { | ||
| protected Long memberId; | ||
| protected MemberType memberType; | ||
| protected String projectAuthorization; | ||
| protected Authorization projectAuthorization; | ||
|
|
||
| public abstract ProjectAuthorization toEntity(Project project, Member member); | ||
|
|
||
|
|
@@ -92,7 +93,7 @@ public static Response create(Long projectId) { | |
| public static class FailList { | ||
| private Long memberId; | ||
| private MemberType memberType; | ||
| private String projectAuthorization; | ||
| private Authorization projectAuthorization; | ||
| private HttpStatus status; | ||
| private String message; | ||
|
|
||
|
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. 코드 패치에 대한 간단한 리뷰를 제공하겠습니다. 아래는 발견된 버그 위험 요소와 개선 제안입니다:
이러한 사항들을 고려하여 코드를 수정하면 좀 더 안정적이고 유지보수하기 쉬운 코드가 될 것입니다. |
||
|
|
||
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.
코드 패치에 대한 간단한 리뷰를 아래에 제시합니다.
코드 리뷰
타입 변경:
projectAuthorization의 타입을String에서Authorization으로 변경했습니다.String으로 표현되는 권한보다Authorization객체를 사용하면 코드의 가독성과 유지보수성이 향상됩니다.의존성:
Authorization클래스를 추가함으로써, 해당 클래스에 대한 의존성이 생깁니다.추상 메서드:
toEntity메서드가 잘 정의되어 있습니다. 하지만 이 메서드의 구현체에서Authorization타입을 어떻게 처리할 것인지에 대한 고려가 필요합니다.Null 안전성:
projectAuthorization을Authorization타입으로 변경하면서, null 값이 될 수 있는 가능성에 대해 확인이 필요합니다.주석 및 문서화:
결론
변경된 코드는 명확성과 타입 안전성을 높이는 긍정적인 방향으로 개선되었습니다. 하지만 의존성 관리와 null 안전성, 및 문서화에 추가적인 주의가 필요합니다. 코드베이스에 통합하기 전에 충분한 테스트를 수행하는 것이 좋습니다.