-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FEAT] 포인트 사용 [유저 데이트 코스 열람] API - #65 #70
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.
진짜 기훈 멋지다.. 저좀 알려주세요 선생님!! 기훈 최고..🙌
User user = userRepository.findById(userId).orElseThrow( | ||
() -> new DateRoadException(FailureCode.USER_NOT_FOUND) | ||
); |
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.
메서드 빼서 관리하면 좋을 것 같아요!
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.
저도 빠질거같아요 당신한테
@Transactional | ||
public void openCourse(final Long userId, final Long courseId, final PointUseReq pointUseReq) { | ||
User user = userRepository.findById(userId).orElseThrow( | ||
() -> new DateRoadException(FailureCode.USER_NOT_FOUND) |
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.
EntityNotFoundException으로 예외처리하면 좋을 것 같아요.
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 void openCourse(final Long userId, final Long courseId, final PointUseReq pointUseReq) { | ||
User user = userRepository.findById(userId).orElseThrow( | ||
() -> new DateRoadException(FailureCode.USER_NOT_FOUND) | ||
); | ||
Course course = courseRepository.findById(courseId).orElseThrow( | ||
() -> new DateRoadException(FailureCode.COURSE_NOT_FOUND) | ||
); |
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.
자주 쓰이는 로직들은 메서드로 분리해서 관리해도 좋을 것 같습니다!
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.
넵 알겠습니다!
return CoursePaymentType.POINT; | ||
} | ||
|
||
public void processCoursePayment(final CoursePaymentType coursePaymentType, User user, final Point point, |
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.
통일하려면 final 선언해주면 좋을 것 같아요!
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.
감사합니다!
switch (coursePaymentType) { | ||
case FREE -> { | ||
asyncService.publishEventUserFree(user); | ||
} | ||
case POINT -> { | ||
pointRepository.save(point); | ||
asyncService.publishEvenUserPoint(user, pointUseReq); | ||
} |
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.
성능측면으로 비교군이 적을 경우 switch보다 if가 낫다고 합니다!ㅎㅎ
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.
엇 예전에는 if-else 가 성능적으로 좋았지만 현재는 그렇게 차이가 나지 않고 switch를 쓰는게 더 효과적이라고 합니다!
저도 보고 찾아보다가 알게되어서 공유합니다!!
https://backendcode.tistory.com/212
User user = userRepository.findById(userId).orElseThrow( | ||
() -> new DateRoadException(FailureCode.USER_NOT_FOUND) | ||
); |
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.
예외처리 클래스 변경이랑 메서드 분리하면 좋을 것 같아요!
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.
알겠씁니다!
@PathVariable final Long courseId, | ||
@RequestBody final PointUseReq pointUseReq | ||
) { | ||
courseService.openCourse(userId,courseId,pointUseReq); |
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.
띄어쓰기요..
# Conflicts: # dateroad-api/src/main/java/org/dateroad/course/api/CourseController.java # dateroad-api/src/main/java/org/dateroad/course/service/CourseService.java
🔥Pull requests
⛳️ 작업한 브랜치
👷 작업한 내용
DATEROAD-SERVER/dateroad-api/src/main/java/org/dateroad/config/RedisStreamConfig.java
Lines 29 to 125 in e3e7691
DATEROAD-SERVER/dateroad-api/src/main/java/org/dateroad/course/service/CourseService.java
Lines 123 to 141 in e3e7691
DATEROAD-SERVER/dateroad-api/src/main/java/org/dateroad/course/service/CourseService.java
Lines 135 to 140 in e3e7691
🚨 참고 사항
📟 관련 이슈