-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add(.remind): 피드백 가능한 계획 목록 조회 API 구현 #199
base: dev
Are you sure you want to change the base?
Conversation
Test Coverage Report
|
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.
작성하시느라 고생하셨어요!
리뷰 한번 확인 바랍니당 ㅎㅎ
src/main/java/me/ajaja/module/feedback/mapper/FeedbackMapper.java
Outdated
Show resolved
Hide resolved
src/main/java/me/ajaja/module/feedback/application/FindUpdatableTargetService.java
Outdated
Show resolved
Hide resolved
src/main/java/me/ajaja/module/plan/adapter/out/persistence/FindUpdatableTargetsAdapter.java
Outdated
Show resolved
Hide resolved
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.
세한님 PR 리뷰가 늦었네요!!
고생하셨습니다!!
리뷰 몇개 남겨봤습니다!
src/main/java/me/ajaja/module/feedback/application/FindUpdatableTargetService.java
Outdated
Show resolved
Hide resolved
src/main/java/me/ajaja/module/plan/adapter/out/persistence/FindUpdatableTargetsAdapter.java
Outdated
Show resolved
Hide resolved
src/main/java/me/ajaja/module/plan/adapter/out/persistence/FindUpdatableTargetsAdapter.java
Outdated
Show resolved
Hide resolved
Test Coverage Report
|
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.
작성하시느라 고생 많으셨어요!
이번 기회로 전체적으로 코드 둘러봤는데 의미없이 노출된 메서드가 많지 않았나? 라는 생각이 들었습니다! 겸4겸4 한번 확인해봐도 좋을 것 같아요!
리뷰도 확인 바랍니당 ㅎㅎ
src/main/java/me/ajaja/module/feedback/application/LoadEvaluableFeedbacksService.java
Outdated
Show resolved
Hide resolved
@@ -46,4 +50,14 @@ public AjajaResponse<FeedbackResponse.FeedbackInfo> getFeedbackInfo(@PathVariabl | |||
FeedbackResponse.FeedbackInfo feedbackInfo = loadFeedbackInfoService.loadFeedbackInfoByPlanId(userId, planId); | |||
return AjajaResponse.ok(feedbackInfo); | |||
} | |||
|
|||
@Authorization | |||
@GetMapping("/updatable") |
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.
하 뭔가 좋은 엔드포인트가 있을 것 같은데... 고민되네요
그냥 컨트롤 URI로 쓰는것도 괜찮을 것 같은데 어떤가요??
// 전
curl -X GET https://api.ajaja.me/feedbacks/updatable
// 후
curl -X GET https://api.ajaja.me/feedbacks/추천좀요
그리고 변수명 수정하면서 엔드포인트는 수정 안되었군요!? ㅋㅋ
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.
6b96c34
"평가 가능한 피드백" 을 나타낼 수 있는게 뭔가 고민해보았는데 흠흠
평가 + able + 복수형 = evaluables 로 해보았는데 어떤가유 ㅋㅋ
이번꺼 네이밍이 전반적으로 애매하네요..
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.
evaluables 이게 나쁘지 않은 것 같기두용 ㅎㅎ?
Test Coverage Report
|
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.
남겨드린 리뷰 한번 보시면 좋을 것 같아요!
@Getter | ||
@RequiredArgsConstructor | ||
private enum RemindTime { | ||
MORNING(9), | ||
AFTERNOON(13), | ||
EVENING(22); | ||
|
||
private final int time; | ||
} | ||
|
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 int getRemindTime() {
// before
return remindTime.getTime();
// after
return remindTime.time;
}
return this.messages.stream().anyMatch(message -> now.isWithinAMonth( | ||
message.parsePeriod(this.createdAt.getYear(), this.getRemindTime()) |
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.
가독성이 떨어져서 라인을 좀 바꿀까요?? 아니면 저처럼 map 쓰셔도 괜찮구!
|
||
@Override | ||
public List<UpdatableFeedback> findEvaluableTargetsByUserId(Long userId) { | ||
BaseTime now = BaseTime.now(); |
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.
method 네이밍이 괜찮아서 바로 사용해도 괜찮을 것 같아요!
public List<Plan> findEvaluablePlansByUserIdAndTime(Long id, BaseTime now) { | ||
return queryFactory.selectFrom(planEntity) | ||
.where(planEntity.userId.eq(id) | ||
.and(planEntity.createdAt.year().eq(now.getYear()))) | ||
.fetch() | ||
.stream() | ||
.map(mapper::toDomain) | ||
.toList(); | ||
} |
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.
네이밍과 쿼리 사이 연관성이 없는 것 같아요..!
그리고 querydsl을 이렇게 쓸거면 JPA로만 처리할 수 있을 것 같아요!
List<FeedbackEntity> entities = queryFactory.selectFrom(feedbackEntity) | ||
.where(feedbackEntity.userId.eq(userId) | ||
.and(feedbackEntity.createdAt.year().eq(BaseTime.now().getYear()))) | ||
.orderBy(feedbackEntity.planId.asc()) | ||
.fetch(); | ||
|
||
return mapper.toDomain(entities); |
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.
다른 곳에서는 stream()으로 잘 넘기시는데 여기서는 달라서 코드에 통일성이 없어 보여요!
아마 원인이 mapper의 문제인 것 같은데 toDomain()
으로 넘기는 것과 달리 결과는 List로 받으니 mapper 네이밍의 문제인 것 같습니다!
public List<Feedback> findAllFeedbacksByUserId(Long userId) { | ||
List<FeedbackEntity> entities = queryFactory.selectFrom(feedbackEntity) | ||
.where(feedbackEntity.userId.eq(userId) | ||
.and(feedbackEntity.createdAt.year().eq(BaseTime.now().getYear()))) |
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.
최저수준에서 직접적으로 application 코드를 사용하라는 의도는 아니였습니다!
repository의 재사용성을 고려해서 시간은 외부에서 받도록!!
🔍 어떤 PR인가요?
😋 To Reviewer
✅ 작성한 테스트