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

[FIX] 케이크 선물하기 #146

Merged
merged 8 commits into from
Dec 3, 2023
Merged

[FIX] 케이크 선물하기 #146

merged 8 commits into from
Dec 3, 2023

Conversation

wlwpfh
Copy link
Collaborator

@wlwpfh wlwpfh commented Nov 27, 2023

✨ 관련 이슈

closed #145

✨ 변경 사항 및 이유

  • 기존의 케이크 선물하기는 pg사 토큰 값, 파트너주문id 등 불필요한 값들이 많아 새로운 api를 만들었습니다.

✨ PR Point

  • 기존의 선물하기는 컨트롤러에서 모든 작업이 이뤄져서 (^ ^);; 비즈니스 로직은 서비스에서 처리하였습니다.
  • 기존의 코드는 기존의 코드 및 테스트 코드가 같이 엮여 있어 일단 createPresentNew라는 함수를 만들었습니다.
  • 기여도를 계산하는 함수를 Util에 넣었습니다.
  • 모든 리뷰 대환영입니다.. 감사합니다 ~

@wlwpfh wlwpfh requested a review from yujindonut November 27, 2023 12:58
@wlwpfh wlwpfh self-assigned this Nov 27, 2023
Copy link
Member

@yujindonut yujindonut left a comment

Choose a reason for hiding this comment

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

지영언니 넘넘 고생하셨습니다~! ! 정말 최고 멋있습니다 최고입니다 ...

public CakeCreateResponseDTO createPresentNew(CakeCreateRequest request) {
val cake = getCake(request.cakeId());
val wish = wishService.getWish(request.wishId());
val present = new Present(request.name(), request.message(), wish, cake);
Copy link
Member

Choose a reason for hiding this comment

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

Present는 Builder 패턴을 이용하는 것으로 알고 있는데, builder 패턴을 이용하는건 어떨까요?

Present.builder()
.name(request.name())
.message(request.message())
.wish(wish)
.cake(cake)
.build()

이런느낌으로 생성자 패턴이 통일되면 더 좋을 것 같습니다~!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

그렇네요 .. 당장 적용하겠습니다!

@@ -31,4 +31,8 @@ private static LocalDateTime convertToTime(String dateTime) throws DateTimeParse
.atZone(ZoneId.of("Asia/Seoul"));
return LocalDateTime.from(instant);
}

public static String calculateContribution(int price, int targetPrice) {
return String.format("%.0f", (double) price / (double) targetPrice * 100);
Copy link
Member

Choose a reason for hiding this comment

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

double은 한쪽에만 붙이고 괄호처리를 하여도 double로 계산이 된다고 알고있습니다!

@wlwpfh wlwpfh merged commit 1b23b49 into develop Dec 3, 2023
1 check passed
@wlwpfh wlwpfh deleted the jiyoung_#145-cake branch December 12, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

케이크 선물하기
2 participants