-
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
[feat] 여행 전체 조회 기능 추가 (#361) #364
Conversation
[refactor] OAuth API 호출에 해당하는 부분을 트랜잭션에서 제외 (#349)
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.
안녕하세요 후추 고생하셨습니다! 일정이 빡빡한데 빨리 구현한다고 고생하셨습니다! 👍 👍
코멘트 몇개 남겼으니 확인해주시면 감사하겠습니다!
추가로 Condition을 적용한 Controller 테스트가 하나 정도 있으면 좋을 것 같습니다!
public QueryDslConfig() { | ||
} |
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 tripCustomRepository.findAllByConditions( | ||
tripQueryConditions, | ||
tripPaging | ||
); |
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.
한 줄로 작성하는건 어떨까요?
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Transactional |
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.
QueryService의 경우 클래스단에 readOnly를 적용하는건 어떤가요?
} | ||
|
||
private BooleanExpression yearIn(Set<Integer> years) { | ||
if (CollectionUtils.isEmpty(years)) { |
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.
null check를 위해 CollectionUtils를 사용하셨군요 👍
@ParameterizedTest | ||
@ValueSource(ints = {2009, 2024}) | ||
void 연도가_2010_미만_2023_초과이면_예외를_던진다(int year) { | ||
// given | ||
Set<Integer> years = of(year); | ||
|
||
// expect | ||
assertThatThrownBy(() -> new TripQueryConditions(years, of(), of(), of(), of(), "")) | ||
.isInstanceOf(TripException.class) | ||
.hasMessage("유효하지 않은 여행 조회 조건입니다."); | ||
} |
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.
경계값 테스트 👍
private static final int FIRST_INDEX = 0; | ||
private final TripRepository tripRepository; |
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.
한 칸 띄우면 좋을 것 같아요 👍
private final TripRepository tripRepository; | ||
private final PointRepository pointRepository; | ||
private final MemberRepository memberRepository; | ||
private final TripQueryService tripQueryService; |
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.
TripService가 TripQueryService를 사용하고 있는데 혹시 어떤 이유로 QueryService를 사용하는지 코멘트 남겨주실 수 있나요?
public record TripSearchResponse( | ||
@Schema(description = "여행 Id", example = "1") | ||
Long tripId, | ||
|
||
@Schema(description = "여행명", example = "통후추의 여행") | ||
String name, | ||
|
||
@Schema(description = "이미지 주소", example = "https://tripdraw.site/post-images/cd678ca2-30d5-11ee-be56-0242ac120002.jpg") | ||
String imageUrl, | ||
|
||
@Schema(description = "경로 이미지 주소", example = "https://tripdraw.site/route-images/cd678ca2-30d5-11ee-be56-0242ac120002.png") | ||
String routeImageUrl | ||
String routeImageUrl, | ||
LocalDateTime startTime, | ||
LocalDateTime endTime |
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.
일관성을 위해서 Schema를 추가하는 것도 좋을 것 같습니다.
public record TripSearchConditions( | ||
Set<Integer> years, | ||
Set<Integer> months, | ||
Set<Integer> daysOfWeek, | ||
Set<Integer> ageRanges, | ||
Set<Integer> genders, | ||
String address | ||
) { |
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.
@Builder
public record TripSearchConditions(
Set<@Range(min = 2010, max = 2023) Integer> years,
Set<@Range(min = 1, max = 12) Integer> months,
Set<@Range(min = 1, max = 7) Integer> daysOfWeek,
Set<@Range(min = 1, max = 10) Integer> ageRanges,
Set<@Range(min = 1, max = 2) Integer> genders,
String address
) {
public TripQueryConditions toTripQueryConditions() {
return new TripQueryConditions(years(), months(), daysOfWeek(), ageRanges(), genders(), address());
}
}
Validation을 이용하는건 어떨까요?
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.
리오는 아직 적용을 안 했던데, 일단은 두고 추후 함께 적용하겠습니다
|
||
@RequiredArgsConstructor | ||
@Repository | ||
public class TripCustomRepositoryImpl implements TripCustomRepository { |
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.
TripQueryRepository로 변경하고 implements를 제거하는건 어떤가요?
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.
어프루브 요청하셨지만 RC합니다 확인해주세요
) { | ||
|
||
public TripQueryConditions toTripQueryConditions() { | ||
return new TripQueryConditions(years(), months(), daysOfWeek(), ageRanges(), genders(), address()); |
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.
TripQueryConditions에도 빌더패턴 적용하면 좋을 것 같아요~
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.
TripQueryConditions 지우고 TripSearchConditions 만 사용하도록 리팩터링 했습니다!
public class TripSearchConditionsFixture { | ||
|
||
public static TripSearchConditions emptyTripSearchConditions() { | ||
return new TripSearchConditions( |
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.
TripSearchConditions에도 빌더 패턴 적용하면 필요한 프로퍼티만 설정할 수 있어서 테스트 코드가 깔끔해질 것 같아요!
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: # backend/src/test/java/dev/tripdraw/auth/domain/RefreshTokenRepositoryTest.java # backend/src/test/java/dev/tripdraw/member/domain/MemberRepositoryTest.java # backend/src/test/java/dev/tripdraw/post/domain/PostRepositoryTest.java # backend/src/test/java/dev/tripdraw/trip/domain/PointRepositoryTest.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.
고생하셨습니다!
📌 관련 이슈
📁 작업 설명
Cursor-based Pagination 구현했습니다.
자세한 내용은 아래에서 확인해주세요!
Pagination #374
모든 회원의 감상이 있는 여행을 조회하는 api를 구현했습니다.
개발한 api 여행 조회에 대한 테스트를 작성했습니다.
관련해서 다음과 같은 에러를 마주했습니다.
@Nested build 실패 에러 #375