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

refactor : product 관련 설정 변경 #76

Merged
merged 3 commits into from
Jan 19, 2024
Merged

Conversation

chan99k
Copy link
Collaborator

@chan99k chan99k commented Jan 19, 2024

💡 Motivation and Context

Product 관련 세부 스펙 변경


🔨 Modified

Product 관련 설정 변경

  • V1.1.1__alter_brand_and_product_table.sql ->> 실행 이력 지우고 다시 재실행 필요
  • SafetyStatus enum 필드와 converter 추가
  • product 필드명 변경… (description -> imgSource, isViolation -> SafetyStatus)
  • SafetyStatus enum 추가

🌟 More



📋 커밋 전 체크리스트

  • 추가/변경에 대한 단위 테스트를 완료하였습니다.
  • 컨벤션에 맞게 작성하였습니다.

🤟🏻 PR로 완료된 이슈

closes #69

… 등) , flyway 스크립트 변경

V1.1.1__alter_brand_and_product_table.sql ->> 실행 이력 지우고 다시 재실행 필요
@chan99k chan99k added 💾 Database 데이터베이스 관련 🔨 Refactor 이 코드는 아주 약간 더 클린코드에 가까워졌습니다... labels Jan 19, 2024
@chan99k chan99k self-assigned this Jan 19, 2024
entity.getReportNumber(),
entity.getIsViolation(),
entity.getSafetyStatus(),
entity.getViewCount(),
entity.getCreatedAt(),
entity.getCreatedBy(),
Copy link

Choose a reason for hiding this comment

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

Here are some observations and suggestions for your code patch:

  1. Import Statement: You imported the SafetyStatus class, which is not mentioned in the code patch. Make sure you're using it correctly.

  2. ProductDto Constructor: In the constructor, you have Long productNo, but you should specify the appropriate type for the field. If it's a numeric ID, consider using Long or Integer.

  3. Naming Convention: Follow the Java naming conventions. Class names should start with an uppercase letter, so ProductDto should be ProductDTO. Similarly, variable names like productNo should start with a lowercase letter (productNo).

  4. Commented Code: Remove commented-out code or TODO/FIXME comments that are no longer relevant or clear.

  5. Field Name Change: It seems that the field isViolation has been replaced by safetyStatus. Ensure that this change is reflected in other parts of the code that use this field.

  6. Missing Setter Method: The ProductDto class defined as a record does not have setter methods. If you need mutability, consider converting it to a regular class or manually create setters.

  7. Usage of entity.getImage(): In the from method, you call entity.getImage(), but there is no corresponding field for image in the constructor or the fields list. Verify if this is intentional or if you missed adding it.

Overall, the provided code snippet looks mostly fine, but do carefully review the areas mentioned above based on the complete codebase and testing requirements.

Copy link
Collaborator

@linglong67 linglong67 left a comment

Choose a reason for hiding this comment

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

LGTM!

if (status == null) {
return null;
}
return status.getCode();
Copy link
Collaborator

Choose a reason for hiding this comment

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

별 건 아니지만 코드 컨벤션 할 때, return 전에 빈 줄 하나 추가하기로 했었던 것 같아요~

Comment on lines 66 to 65
product_no BIGSERIAL NOT NULL,
product_no BIGINT NOT NULL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기는 BIGSERIAL이 맞지 않나요?

import java.time.LocalDate;

/**
* DTO for {@link com.kernel360.product.entity.Product}
*/
// FIXME :: Product 테이블 변경에 따라서 toEntity 또한 변경되어야 함.
public record ProductDto(Long productNo,
String productName,
String barcode,
String description,
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 변경해야 할듯 합니다

@@ -26,7 +26,7 @@ public static ProductDto of(
String barcode,
String description,
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 변경해야 할듯 합니다

import jakarta.persistence.Converter;
import java.util.stream.Stream;

@Converter(autoApply = true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

이건 무슨 어노테이션인가요? 자동으로 convert 되는건가요?

V1.1.1__alter_brand_and_product_table.sql ->> 실행 이력 지우고 다시 재실행 필요
entity.getReportNumber(),
entity.getIsViolation(),
entity.getSafetyStatus(),
entity.getViewCount(),
entity.getCreatedAt(),
entity.getCreatedBy(),
Copy link

Choose a reason for hiding this comment

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

  1. In the ProductDto class, there is a comment mentioning that the toEntity method needs to be changed due to changes in the Product table. It would be helpful to review and update the toEntity method accordingly.

  2. It seems that the variables description, declareNo, and isViolation have been removed from the ProductDto record. Make sure this change aligns with the required functionality. If these fields are still necessary, they need to be incorporated back into the record.

  3. Check if the parameter names in the of and from methods match the field names in the Product entity class. It's important to ensure the correct mapping between the DTO and the entity.

  4. Verify if the variable imageSource corresponds to the property image in the Product entity, as it was referenced in the from method. If they represent the same information, make sure to use consistent terminology.

  5. Confirm that the type of the safetyStatus field in the ProductDto and Product entity matches correctly. It appears to be of type SafetyStatus, so ensure this type is properly defined and implemented.

  6. Consider adding appropriate error handling or validation checks for the input parameters in the of method, if necessary.

Overall, it's important to carefully review and verify the changes made to ensure that the code behaves as expected and that all necessary fields are properly handled in the DTO and entity classes.

Copy link
Collaborator

@HyunJunSon HyunJunSon left a comment

Choose a reason for hiding this comment

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

LGTM

@chan99k chan99k merged commit 4aa63fd into Kernel360:develop Jan 19, 2024
1 check passed
@chan99k chan99k deleted the feat/#69 branch January 23, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💾 Database 데이터베이스 관련 🔨 Refactor 이 코드는 아주 약간 더 클린코드에 가까워졌습니다...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor :: Product 테이블 is_violation 컬럼을 Enum으로 수정
3 participants