Skip to content

Commit

Permalink
Merge pull request #85 from kakao-tech-campus-2nd-step3/week11
Browse files Browse the repository at this point in the history
�weekly: 수정 내용 반영
  • Loading branch information
5win authored Nov 13, 2024
2 parents f7ba990 + e9c55f4 commit e32f082
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/gamsa/Application.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gamsa;

import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
Expand All @@ -12,6 +13,7 @@
@SpringBootApplication
public class Application {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"));
SpringApplication.run(Application.class, args);
}
}
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 e32f082

Please sign in to comment.