-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Trip 전체 조회 api QueryString 방식으로 수정 (#379)
- Loading branch information
Showing
7 changed files
with
244 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 23 additions & 4 deletions
27
backend/src/main/java/dev/tripdraw/trip/dto/TripSearchRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
package dev.tripdraw.trip.dto; | ||
|
||
import dev.tripdraw.trip.query.TripPaging; | ||
import java.util.Set; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record TripSearchRequest( | ||
|
||
TripSearchConditions condition, | ||
TripSearchPaging paging | ||
Set<Integer> years, | ||
Set<Integer> months, | ||
Set<Integer> daysOfWeek, | ||
Set<Integer> ageRanges, | ||
Set<Integer> genders, | ||
String address, | ||
Long lastViewedId, | ||
Integer limit | ||
) { | ||
|
||
public TripSearchConditions toTripSearchConditions() { | ||
return TripSearchConditions.builder() | ||
.years(years) | ||
.months(months) | ||
.daysOfWeek(daysOfWeek) | ||
.ageRanges(ageRanges) | ||
.genders(genders) | ||
.address(address) | ||
.build(); | ||
} | ||
|
||
public TripPaging toTripPaging() { | ||
return paging.toTripPaging(); | ||
return new TripPaging(lastViewedId, limit); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
backend/src/test/java/dev/tripdraw/test/fixture/TripSearchQueryParamsFixture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package dev.tripdraw.test.fixture; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
public class TripSearchQueryParamsFixture { | ||
|
||
public static Map<String, Object> limitParams(int limit) { | ||
return Map.of("limit", limit); | ||
} | ||
|
||
public static Map<String, Object> lastViewedIdAndLimitParams(Long lastViewedId, int limit) { | ||
return Map.of( | ||
"lastViewedId", lastViewedId, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> yearsAndLimitParams(Set<Integer> years, int limit) { | ||
return Map.of( | ||
"years", years, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> monthsAndLimitParams(Set<Integer> months, int limit) { | ||
return Map.of( | ||
"months", months, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> daysOfWeekAndLimitParams(Set<Integer> daysOfWeek, int limit) { | ||
return Map.of( | ||
"daysOfWeek", daysOfWeek, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> ageRangesAndLimitParams(Set<Integer> ageRanges, int limit) { | ||
return Map.of( | ||
"ageRanges", ageRanges, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> gendersAndLimitParams(Set<Integer> genders, int limit) { | ||
return Map.of( | ||
"genders", genders, | ||
"limit", limit | ||
); | ||
} | ||
|
||
public static Map<String, Object> addressAndLimitParams(String address, int limit) { | ||
return Map.of( | ||
"address", address, | ||
"limit", limit | ||
); | ||
} | ||
} |
Oops, something went wrong.