-
Notifications
You must be signed in to change notification settings - Fork 0
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
#226 [refactor] 제안서 작성 service 분리 #227
Conversation
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.
구우욷 bb
@PathVariable(value = "applicationId") Long applicationId, | ||
@Valid @RequestBody OfferCreateRequest offerCreateRequest) throws IOException { | ||
designerService.postOffer(userId, applicationId, offerCreateRequest); | ||
hairServiceOfferRegisterService.postOffer(designerId, applicationId, offerCreateRequest); | ||
return SuccessNonDataResponse.success(SuccessCode.POST_OFFER_SUCCESS); | ||
} |
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.
p2 :
요 친구들도 OfferController로 이동해야할것 같습니다~!
HairServiceOffer offer = HairServiceOffer.builder() | ||
.model(model) | ||
.hairModelApplication(hairModelApplication) | ||
.designer(designer) | ||
.offerDetail(request.offerDetail()) | ||
.isModelAgree(false) | ||
.isClicked(false) | ||
.build(); | ||
hairServiceOfferJpaRepository.save(offer); | ||
|
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.
p2 :
Entity에 직접적으로 Builder 사용은 최대한 줄여보고 차라리 생성자를 만들어서 작업해보는 것은 어떨까요?
관련해서 왜 Builder 사용을 줄이자 했는지 기억이 안나서 제가 PR에 질문 올렸는데 원용이가 답변 해준거 링크 두고 갑니다.. 링크
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.
p2:
builder를 제거하고, Offer 도메인 클래스 내에 model, hairModelApplication, designer, offerDetial을 파라미터로 받는 생성자를 하나 만들어 값을 넣어주고,
isModelAgree, isClicked 같은 경우는 생성자 내부에서 false로 지정해준다면
생성자 파라미터가 4개라 많이 헷갈리지 않을 것이라고 생각합니다..!
final String modelName = model.getName(); | ||
final String modelPhoneNumber = model.getPhoneNumber(); | ||
smsUtil.sendOfferToModel(modelPhoneNumber, modelName); | ||
} |
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.
p4:
나머지 로직들은 DB에 저장하는 거라 개념이 비슷한데 sms를 보내는 부분은 따로 private 메소드 따로 만들면 좋을거 같아요..! 너무 다른 로직(?)개념이라 빼는게 좋을거 같다는 생각을 했답니다!
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.
작업하시느라 고생하셨습니다!
코맨트 확인해주세요!
public PreferOfferCondition(HairServiceOffer hairServiceOffer, OfferCondition offerCondition){ | ||
this.hairServiceOffer = hairServiceOffer; | ||
this.offerCondition = offerCondition; | ||
} |
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.
p3
파라미터를 final로 명시해주면 좋을 것 같습니다!
HairServiceOffer offer = HairServiceOffer.builder() | ||
.model(model) | ||
.hairModelApplication(hairModelApplication) | ||
.designer(designer) | ||
.offerDetail(request.offerDetail()) | ||
.isModelAgree(false) | ||
.isClicked(false) | ||
.build(); | ||
hairServiceOfferJpaRepository.save(offer); | ||
|
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.
p2:
builder를 제거하고, Offer 도메인 클래스 내에 model, hairModelApplication, designer, offerDetial을 파라미터로 받는 생성자를 하나 만들어 값을 넣어주고,
isModelAgree, isClicked 같은 경우는 생성자 내부에서 false로 지정해준다면
생성자 파라미터가 4개라 많이 헷갈리지 않을 것이라고 생각합니다..!
@Transactional | ||
public void postOffer(Long designerId, Long applicationId, OfferCreateRequest request) throws IOException { | ||
Designer designer = designerJpaRepository.findById(designerId).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); |
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.
p3
파라미터를 final로 명시해주면 좋을 것 같습니다!
…into refactor/#226 # Conflicts: # src/main/java/com/moddy/server/service/offer/HairServiceOfferRegisterService.java
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.
코맨트 확인해주세요!
@@ -41,10 +43,20 @@ public class HairServiceOffer extends BaseTimeEntity { | |||
@NotNull | |||
private Boolean isClicked; | |||
|
|||
public HairServiceOffer(@NotNull HairModelApplication hairModelApplication, @NotNull Model model, @NotNull Designer designer, @NotNull String offerDetail, @NotNull Boolean isModelAgree, @NotNull Boolean isClicked) { |
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.
p3
@NotNull
과 같은 Validation 어노테이션을 도메인에 붙인 이유가 있을까요???
p2
객체타입인 Boolean 대신 원시타입인 boolean 을 사용해주세요!
…into refactor/#226 # Conflicts: # src/main/java/com/moddy/server/controller/designer/DesignerController.java # src/main/java/com/moddy/server/controller/offer/OfferController.java # src/main/java/com/moddy/server/service/designer/DesignerService.java
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.
작업하시느라 고생하셨습니다!
변수 제거해주시고 머지하시면 좋을 거 같아요!
@@ -46,6 +42,7 @@ public class DesignerController { | |||
private final DesignerService designerService; | |||
private final DesignerRegisterService designerRegisterService; | |||
private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService; | |||
private final HairServiceOfferRegisterService hairServiceOfferRegisterService; |
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.
p2
사용하지 않는 변수는 제거해주세요!
관련 이슈번호
해결하는 데 얼마나 걸렸나요? (예상 작업 시간 / 실제 작업 시간)
해결하려는 문제가 무엇인가요?
어떻게 해결했나요?
offerCondition 빌더 제거
offer 빌더는 제가 너무 헷갈려서... builder 를 유지했습니다