Skip to content

Commit b5cc63b

Browse files
authored
Hotfix : 파티 상세 조회에서 유저 좌표 입력 request param 방식으로 변경 (#61)
* Hotfix: 유저 좌표 입력 requestParam 형식으로 변경
1 parent 6eaf71f commit b5cc63b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/main/java/ita/tinybite/domain/party/controller/PartyController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,12 @@ public ResponseEntity<PartyListResponse> getPartyList(
321321
public ResponseEntity<PartyDetailResponse> getPartyDetail(
322322
@PathVariable Long partyId,
323323
@RequestHeader("Authorization") String token,
324-
@RequestBody UserLocation userLocation
324+
@RequestParam(required = false) Double userLat,
325+
@RequestParam(required = false) Double userLon
325326
) {
326327
Long userId = jwtTokenProvider.getUserId(token);
327328

328-
PartyDetailResponse response = partyService.getPartyDetail(partyId, userId,userLocation);
329+
PartyDetailResponse response = partyService.getPartyDetail(partyId, userId,userLat,userLon);
329330
return ResponseEntity.ok(response);
330331
}
331332

src/main/java/ita/tinybite/domain/party/service/PartyService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public PartyListResponse getPartyList(Long userId, PartyCategory category) {
182182
/**
183183
* 파티 상세 조회
184184
*/
185-
public PartyDetailResponse getPartyDetail(Long partyId, Long userId, UserLocation userLocation) {
185+
public PartyDetailResponse getPartyDetail(Long partyId, Long userId, Double userLat, Double userLon) {
186186
Party party = partyRepository.findById(partyId)
187187
.orElseThrow(() -> new IllegalArgumentException("파티를 찾을 수 없습니다"));
188188

@@ -200,10 +200,10 @@ public PartyDetailResponse getPartyDetail(Long partyId, Long userId, UserLocatio
200200

201201
// 거리 계산 (사용자 위치 필요)
202202
double distance = 0.0;
203-
if (validateLocation(user,userLocation,party)) {
203+
if (validateLocation(user,userLat, userLon,party)) {
204204
distance = DistanceCalculator.calculateDistance(
205-
userLocation.getLatitude(),
206-
userLocation.getLongitude(),
205+
userLat,
206+
userLon,
207207
party.getPickupLocation().getPickupLatitude(),
208208
party.getPickupLocation().getPickupLongitude()
209209
);
@@ -212,10 +212,10 @@ public PartyDetailResponse getPartyDetail(Long partyId, Long userId, UserLocatio
212212
return convertToDetailResponse(party, distance, isParticipating);
213213
}
214214

215-
private boolean validateLocation(User user, UserLocation userLocation, Party party) {
215+
private boolean validateLocation(User user, Double userLat, Double userLon, Party party) {
216216
return (user != null
217-
&& userLocation.getLatitude() != null
218-
&& userLocation.getLongitude()!= null
217+
&& userLat != null
218+
&& userLon!= null
219219
&& party.getPickupLocation().getPickupLatitude()!= null
220220
&& party.getPickupLocation().getPickupLongitude()!=null);
221221
}

0 commit comments

Comments
 (0)