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

#226 [refactor] 제안서 작성 service 분리 #227

Merged
merged 6 commits into from
Feb 7, 2024
Merged

Conversation

pkl0912
Copy link
Contributor

@pkl0912 pkl0912 commented Jan 31, 2024

관련 이슈번호

해결하는 데 얼마나 걸렸나요? (예상 작업 시간 / 실제 작업 시간)

  • 30m~1h

해결하려는 문제가 무엇인가요?

어떻게 해결했나요?

  • 제안서 작성 service 를 hairServiceOfferRegister Service 로 변경,
    offerCondition 빌더 제거
    offer 빌더는 제가 너무 헷갈려서... builder 를 유지했습니다

@pkl0912 pkl0912 self-assigned this Jan 31, 2024
Copy link
Member

@hellozo0 hellozo0 left a 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);
}
Copy link
Member

Choose a reason for hiding this comment

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

p2 :
요 친구들도 OfferController로 이동해야할것 같습니다~!

Comment on lines 58 to 67
HairServiceOffer offer = HairServiceOffer.builder()
.model(model)
.hairModelApplication(hairModelApplication)
.designer(designer)
.offerDetail(request.offerDetail())
.isModelAgree(false)
.isClicked(false)
.build();
hairServiceOfferJpaRepository.save(offer);

Copy link
Member

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에 질문 올렸는데 원용이가 답변 해준거 링크 두고 갑니다.. 링크

Copy link
Member

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개라 많이 헷갈리지 않을 것이라고 생각합니다..!

Comment on lines 75 to 78
final String modelName = model.getName();
final String modelPhoneNumber = model.getPhoneNumber();
smsUtil.sendOfferToModel(modelPhoneNumber, modelName);
}
Copy link
Member

Choose a reason for hiding this comment

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

p4:
나머지 로직들은 DB에 저장하는 거라 개념이 비슷한데 sms를 보내는 부분은 따로 private 메소드 따로 만들면 좋을거 같아요..! 너무 다른 로직(?)개념이라 빼는게 좋을거 같다는 생각을 했답니다!

Copy link
Member

@KWY0218 KWY0218 left a comment

Choose a reason for hiding this comment

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

작업하시느라 고생하셨습니다!
코맨트 확인해주세요!

Comment on lines 30 to 33
public PreferOfferCondition(HairServiceOffer hairServiceOffer, OfferCondition offerCondition){
this.hairServiceOffer = hairServiceOffer;
this.offerCondition = offerCondition;
}
Copy link
Member

Choose a reason for hiding this comment

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

p3
파라미터를 final로 명시해주면 좋을 것 같습니다!

Comment on lines 58 to 67
HairServiceOffer offer = HairServiceOffer.builder()
.model(model)
.hairModelApplication(hairModelApplication)
.designer(designer)
.offerDetail(request.offerDetail())
.isModelAgree(false)
.isClicked(false)
.build();
hairServiceOfferJpaRepository.save(offer);

Copy link
Member

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개라 많이 헷갈리지 않을 것이라고 생각합니다..!

Comment on lines 51 to 53
@Transactional
public void postOffer(Long designerId, Long applicationId, OfferCreateRequest request) throws IOException {
Designer designer = designerJpaRepository.findById(designerId).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION));
Copy link
Member

Choose a reason for hiding this comment

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

p3
파라미터를 final로 명시해주면 좋을 것 같습니다!

pkl0912 added 2 commits February 6, 2024 19:06
…into refactor/#226

# Conflicts:
#	src/main/java/com/moddy/server/service/offer/HairServiceOfferRegisterService.java
Copy link
Member

@KWY0218 KWY0218 left a 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) {
Copy link
Member

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 을 사용해주세요!

pkl0912 added 2 commits February 7, 2024 13:59
…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
Copy link
Member

@KWY0218 KWY0218 left a 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;
Copy link
Member

Choose a reason for hiding this comment

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

p2
사용하지 않는 변수는 제거해주세요!

@pkl0912 pkl0912 merged commit 07beda1 into develop Feb 7, 2024
1 check passed
@pkl0912 pkl0912 deleted the refactor/#226 branch February 7, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[refactor] 제안서 작성하기 service 분리
3 participants