Skip to content

Commit

Permalink
Merge pull request
Browse files Browse the repository at this point in the history
프론트 요청에 따른 2024-02-06 배포
  • Loading branch information
eple0329 authored Feb 5, 2024
2 parents 988427d + 7a6a90a commit ea74b76
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.climeet.climeet_backend.global.response.code.status.ErrorStatus;
import com.climeet.climeet_backend.global.response.exception.GeneralException;
import com.climeet.climeet_backend.global.s3.S3Service;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -165,28 +164,27 @@ public PageResponseDto<List<RouteDetailResponse>> getRouteVersionFilteringRouteL
}

// floor Filter 적용
if (getFilteredRouteVersionRequest.getFloorList().length != 0) {
if (getFilteredRouteVersionRequest.getFloor() != null) {
routeList = routeList.stream()
.filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getFloorList())
.anyMatch(floor -> floor == route.getSector().getFloor())
).toList();
.filter(route -> route.getSector().getFloor()
== getFilteredRouteVersionRequest.getFloor())
.toList();
}

// sector Filter 적용
if (getFilteredRouteVersionRequest.getSectorIdList().length != 0) {
if (getFilteredRouteVersionRequest.getSectorId() != null) {
routeList = routeList.stream()
.filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getSectorIdList())
.anyMatch(sectorId -> sectorId == route.getSector().getId())
).toList();
.filter(route -> route.getSector().getId()
== getFilteredRouteVersionRequest.getSectorId())
.toList();
}

// difficulty Filter 적용
if (getFilteredRouteVersionRequest.getDifficultyList().length != 0) {
if (getFilteredRouteVersionRequest.getDifficulty() != null) {
routeList = routeList.stream()
.filter(route -> Arrays.stream(getFilteredRouteVersionRequest.getDifficultyList())
.anyMatch(
difficulty -> difficulty == route.getDifficultyMapping().getDifficulty())
).toList();
.filter(route -> route.getDifficultyMapping().getDifficulty()
== getFilteredRouteVersionRequest.getDifficulty())
.toList();
}

List<RouteDetailResponse> routeDetailResponseList = routeList.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public static class GetFilteredRouteVersionRequest {

private int page;
private int size;
private int[] floorList = null;
private Long[] sectorIdList = null;
private int[] difficultyList = null;
private Integer floor;
private Long sectorId;
private Integer difficulty;

@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate timePoint;

public GetFilteredRouteVersionRequest() {
this.floorList = new int[0];
this.sectorIdList = new Long[0];
this.difficultyList = new int[0];
this.floor = null;
this.sectorId = null;
this.difficulty = null;
this.timePoint = LocalDate.now();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ public class SectorResponseDto {
@AllArgsConstructor
public static class SectorDetailResponse {

private Long sectorId;
private String name;
private int floor;
private String sectorImageUrl;

public static SectorDetailResponse toDto(Sector sector) {
return SectorDetailResponse.builder()
.sectorId(sector.getId())
.name(sector.getSectorName())
.floor(sector.getFloor())
.sectorImageUrl(sector.getSectorImageUrl())
Expand Down

0 comments on commit ea74b76

Please sign in to comment.