-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BE] refactor: 놀이터 전체조회->범위조회로 변경 #780
Conversation
Test Results230 tests 230 ✅ 31s ⏱️ Results for commit 3689969. |
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.
👍
@GetMapping("/locations") | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocation(@Auth Long memberId) { | ||
return ApiResponse.ofSuccess(playgroundQueryService.findLocations(memberId)); | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocations( | ||
@Auth Long memberId, | ||
@RequestParam(defaultValue = MIN_KOREA_LATITUDE) double startLatitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LATITUDE) double endLatitude, | ||
@RequestParam(defaultValue = MIN_KOREA_LONGITUDE) double startLongitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LONGITUDE) double endLongitude | ||
) { |
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.
아 defaultValue
가 있어서 이전 버전에서 쓰면 전체 조회 되는거죠?!
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.
ModelAttribute로 받으면 더 깔끔할 것 같기도~?
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.
같은 방법을 생각했었는데, 일단 보일러 플레이트제거를 위해 Record를 사용했다면, 아래와 같은 코드가 나옵니다.
public record FindPlaygroundLocationRequest(
Double startLatitude,
Double endLatitude,
Double startLongitude,
Double endLongitude
) {
private static final double MIN_KOREA_LATITUDE = 33.0637;
private static final double MAX_KOREA_LATITUDE = 43.0042;
private static final double MIN_KOREA_LONGITUDE = 124.1104;
private static final double MAX_KOREA_LONGITUDE = 131.4220;
public FindPlaygroundLocationRequest {
startLatitude = startLatitude == null ? MIN_KOREA_LATITUDE : startLatitude;
endLatitude = endLatitude == null ? MAX_KOREA_LATITUDE : endLatitude;
startLongitude = startLongitude == null ? MIN_KOREA_LONGITUDE : startLongitude;
endLongitude = endLongitude == null ? MAX_KOREA_LONGITUDE : endLongitude;
}
}
래퍼타입이 아닌 double을 하면 null로 입력을 못받기에 래퍼타입을 사용했고, 해당 로직으로 기본값을 설정해주게 됩니다.
불필요한 래퍼타입을 사용하기도하고, 해당 로직이 Dto에 들어가기에는 겉으로 들어나야하는 중요한 로직이 아닐까라는 생각으로 컨트롤러에 드러냈습니다
@GetMapping("/locations") | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocation(@Auth Long memberId) { | ||
return ApiResponse.ofSuccess(playgroundQueryService.findLocations(memberId)); | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocations( | ||
@Auth Long memberId, | ||
@RequestParam(defaultValue = MIN_KOREA_LATITUDE) double startLatitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LATITUDE) double endLatitude, | ||
@RequestParam(defaultValue = MIN_KOREA_LONGITUDE) double startLongitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LONGITUDE) double endLongitude | ||
) { |
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.
ModelAttribute로 받으면 더 깔끔할 것 같기도~?
@GetMapping("/locations") | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocation(@Auth Long memberId) { | ||
return ApiResponse.ofSuccess(playgroundQueryService.findLocations(memberId)); | ||
public ApiResponse<List<FindPlaygroundLocationResponse>> findAllLocations( | ||
@Auth Long memberId, | ||
@RequestParam(defaultValue = MIN_KOREA_LATITUDE) double startLatitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LATITUDE) double endLatitude, | ||
@RequestParam(defaultValue = MIN_KOREA_LONGITUDE) double startLongitude, | ||
@RequestParam(defaultValue = MAX_KOREA_LONGITUDE) double endLongitude | ||
) { |
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.
이슈
개발 사항