Skip to content

Commit

Permalink
fix: 좌표정보를 쿼리스트링으로 받도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
5win committed Nov 13, 2024
1 parent e314076 commit b4a4b1b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import com.gamsa.activity.dto.ActivityFindDistanceOrderRequest;
import com.gamsa.activity.dto.ActivityFindSliceResponse;
import com.gamsa.activity.service.ActivityService;
import java.math.BigDecimal;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -31,9 +31,12 @@ public Slice<ActivityFindSliceResponse> findSlice(
@RequestParam(defaultValue = "false") boolean teenPossibleOnly,
@RequestParam(defaultValue = "false") boolean beforeDeadlineOnly,
@RequestParam(required = false) String keyword,
@RequestBody(required = false) ActivityFindDistanceOrderRequest distanceOrderRequest,
@RequestParam(required = false) BigDecimal latitude,
@RequestParam(required = false) BigDecimal longitude,
@RequestParam(required = false, defaultValue = "10") Integer distanceKm,
Pageable pageable) {

// 필터링, 검색 관련 정보
ActivityFilterRequest filterRequest = ActivityFilterRequest.builder()
.category(Category.fromValuesForSlice(category))
.sidoGunguCode(sidoGunguCode)
Expand All @@ -43,6 +46,13 @@ public Slice<ActivityFindSliceResponse> findSlice(
.keyword(keyword)
.build();

// 가까운 거리순 정렬 관련 정보
ActivityFindDistanceOrderRequest distanceOrderRequest = ActivityFindDistanceOrderRequest.builder()
.latitude(latitude)
.longitude(longitude)
.distanceKm(distanceKm)
.build();

return activityService.findSlice(filterRequest, distanceOrderRequest, pageable);
}

Expand Down

0 comments on commit b4a4b1b

Please sign in to comment.