Skip to content

Commit beadfab

Browse files
authored
release(v1.0.3): 프론트 요구사항 반영
[Release] v1.0.3 프론트 요구사항 반영
2 parents 44095c6 + 165b109 commit beadfab

36 files changed

+978
-216
lines changed

src/main/java/shympyo/auth/controller/AuthController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ResponseEntity<CommonResponse<TokenResponse>> login(@RequestBody @Valid L
4545
description = "현재 로그인한 사용자의 RefreshToken을 무효화한다."
4646
)
4747
@PostMapping("/logout")
48-
public ResponseEntity<CommonResponse<Void>> logout(@AuthenticationPrincipal CustomUserDetails userDetails) {
48+
public ResponseEntity<CommonResponse> logout(@AuthenticationPrincipal CustomUserDetails userDetails) {
4949

5050
userService.logout(userDetails.getId());
5151

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package shympyo.global.response;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Getter;
5+
6+
import java.util.List;
7+
8+
@Getter
9+
@AllArgsConstructor
10+
public class CursorPageResponse<T> {
11+
12+
private List<T> content;
13+
private boolean hasNext;
14+
15+
}

src/main/java/shympyo/global/response/ResponseUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public static <T> ResponseEntity<CommonResponse<T>> success(String message, T da
1616

1717
}
1818

19-
public static <T> ResponseEntity<CommonResponse<T>> success(String message){
19+
public static <T> ResponseEntity<CommonResponse> success(String message){
2020

21-
return ResponseEntity.ok(new CommonResponse<>(true, 200, message));
21+
return ResponseEntity.ok(new CommonResponse(true, 200, message));
2222

2323
}
2424

src/main/java/shympyo/map/controller/MapController.java

Lines changed: 83 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import io.swagger.v3.oas.annotations.Operation;
44
import io.swagger.v3.oas.annotations.Parameter;
5+
import io.swagger.v3.oas.annotations.media.ArraySchema;
56
import io.swagger.v3.oas.annotations.tags.Tag;
67
import lombok.RequiredArgsConstructor;
78
import org.springframework.http.ResponseEntity;
89
import org.springframework.web.bind.annotation.*;
910
import shympyo.global.response.CommonResponse;
1011
import shympyo.global.response.ResponseUtil;
12+
import shympyo.map.domain.PlaceType;
1113
import shympyo.map.dto.NearbyListResponse;
1214
import shympyo.map.dto.NearbyMapResponse;
1315
import shympyo.map.dto.PlaceDetailResponse;
@@ -25,40 +27,103 @@ public class MapController {
2527

2628
@Operation(
2729
summary = "주변 장소 지도 조회",
28-
description = "위도(lat), 경도(lon) 좌표를 기준으로 반경 내 장소를 지도 형태로 조회한다."
30+
description = """
31+
위도(lat), 경도(lon) 좌표를 기준으로 반경 내 장소를 지도용으로 조회한다.
32+
33+
- `radius` : 검색 반경 (미터), 최소 1m ~ 최대 5km
34+
- `limit` : 조회 최대 개수, 최대 200
35+
- `types` : 조회할 장소 타입 필터 (예: CULTURE, SHELTER, USER_SHELTER 등).
36+
- 여러 개 지정 가능 → `types=CULTURE&types=SHELTER`
37+
- 쉼표 구분도 가능 → `types=CULTURE,SHELTER`
38+
- 비워두면 모든 타입 조회
39+
"""
2940
)
3041
@GetMapping("/nearby")
3142
public ResponseEntity<CommonResponse<List<NearbyMapResponse>>> nearby(
32-
@Parameter(description = "위도", example = "37.5665") @RequestParam double lat,
33-
@Parameter(description = "경도", example = "126.9780") @RequestParam double lon,
34-
@Parameter(description = "검색 반경 (미터)", example = "200") @RequestParam(defaultValue = "100") int radius,
35-
@Parameter(description = "조회 최대 개수", example = "50") @RequestParam(defaultValue = "100") int limit
43+
@Parameter(description = "위도", example = "37.5665")
44+
@RequestParam double lat,
45+
46+
@Parameter(description = "경도", example = "126.9780")
47+
@RequestParam double lon,
48+
49+
@Parameter(description = "검색 반경 (m)", example = "200")
50+
@RequestParam(defaultValue = "100") int radius,
51+
52+
@Parameter(description = "조회 최대 개수", example = "50")
53+
@RequestParam(defaultValue = "100") int limit,
54+
55+
@Parameter(
56+
description = "조회할 타입 목록. 예: types=CULTURE,SHELTER or types=CULTURE&types=SHELTER",
57+
array = @io.swagger.v3.oas.annotations.media.ArraySchema(
58+
schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = shympyo.map.domain.PlaceType.class)
59+
)
60+
)
61+
@RequestParam(name = "types", required = false) List<PlaceType> types
3662
) {
37-
return ResponseUtil.success(mapService.findNearby(lat, lon, radius, limit));
63+
return ResponseUtil.success(mapService.findNearby(lat, lon, radius, limit, types));
3864
}
3965

66+
67+
4068
@Operation(
4169
summary = "주변 장소 목록 조회",
42-
description = "위도(lat), 경도(lon) 좌표를 기준으로 반경 내 장소를 리스트 형태로 조회한다."
70+
description = """
71+
위도(lat), 경도(lon) 좌표를 기준으로 반경 내 장소를 리스트 형태로 조회한다.
72+
73+
- `radius` : 검색 반경 (미터), 최소 1m ~ 최대 5km
74+
- `limit` : 조회 최대 개수, 최대 200
75+
- `types` : 조회할 장소 타입 필터 (예: CULTURE, SHELTER, USER_SHELTER 등).
76+
- 여러 개 지정 가능 → `types=CULTURE&types=SHELTER`
77+
- 쉼표 구분도 가능 → `types=CULTURE,SHELTER`
78+
- 비워두면 모든 타입 조회
79+
"""
4380
)
4481
@GetMapping("/nearby-list")
4582
public ResponseEntity<CommonResponse<List<NearbyListResponse>>> nearbyList(
46-
@Parameter(description = "위도", example = "37.5665") @RequestParam double lat,
47-
@Parameter(description = "경도", example = "126.9780") @RequestParam double lon,
48-
@Parameter(description = "검색 반경 (미터)", example = "200") @RequestParam(defaultValue = "100") int radius,
49-
@Parameter(description = "조회 최대 개수", example = "20") @RequestParam(defaultValue = "50") int limit
83+
@Parameter(description = "위도", example = "37.5665")
84+
@RequestParam double lat,
85+
86+
@Parameter(description = "경도", example = "126.9780")
87+
@RequestParam double lon,
88+
89+
@Parameter(description = "검색 반경 (m)", example = "200")
90+
@RequestParam(defaultValue = "100") int radius,
91+
92+
@Parameter(description = "조회 최대 개수", example = "50")
93+
@RequestParam(defaultValue = "50") int limit,
94+
95+
@Parameter(
96+
description = "조회할 타입 목록. 여러 개 가능 (예: CULTURE,SHELTER)",
97+
array = @ArraySchema(
98+
schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = shympyo.map.domain.PlaceType.class)
99+
)
100+
)
101+
@RequestParam(name = "types", required = false) List<PlaceType> types
102+
) {
103+
return ResponseUtil.success(mapService.findNearbyList(lat, lon, radius, limit, types));
104+
}
105+
106+
107+
@Operation(
108+
summary = "공공 쉼터 상세 조회",
109+
description = "공공 데이터(Map)에 등록된 쉼터의 상세 정보를 조회한다."
110+
)
111+
@GetMapping("/public/{id}")
112+
public ResponseEntity<CommonResponse<PlaceDetailResponse>> getMap(
113+
@Parameter(description = "공공 쉼터 ID", example = "123")
114+
@PathVariable Long id
50115
) {
51-
return ResponseUtil.success(mapService.findNearbyList(lat, lon, radius, limit));
116+
return ResponseUtil.success(mapService.getMap(id));
52117
}
53118

54119
@Operation(
55-
summary = "장소 상세 조회",
56-
description = "장소 ID를 사용해 상세 정보를 조회한다."
120+
summary = "사용자 제공 쉼터 상세 조회",
121+
description = "민간 데이터(Place)에 등록된 쉼터의 상세 정보를 조회한다."
57122
)
58-
@GetMapping("/{id}")
59-
public ResponseEntity<CommonResponse<PlaceDetailResponse>> place(
60-
@Parameter(description = "장소 ID", example = "123") @PathVariable Long id
123+
@GetMapping("/user/{id}")
124+
public ResponseEntity<CommonResponse<PlaceDetailResponse>> getPlace(
125+
@PathVariable Long id
61126
) {
62-
return ResponseUtil.success(mapService.findPlace(id));
127+
return ResponseUtil.success(mapService.getPlace(id));
63128
}
64129
}

src/main/java/shympyo/map/domain/PlaceType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ public enum PlaceType {
44
CULTURE,
55
SHELTER,
66
STATION,
7-
CLIMATE_SHELTER
7+
CLIMATE_SHELTER,
8+
USER_SHELTER
89
}

src/main/java/shympyo/map/repository/MapRepository.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.data.repository.query.Param;
77
import org.springframework.stereotype.Repository;
88
import shympyo.map.domain.Map;
9+
import shympyo.map.domain.PlaceType;
910

1011
import java.util.List;
1112

@@ -25,4 +26,16 @@ List<Map> findInBoundingBox(
2526
@Param("maxLon") double maxLon
2627
);
2728

29+
@Query("""
30+
SELECT m
31+
FROM Map m
32+
WHERE m.latitude BETWEEN :minLat AND :maxLat
33+
AND m.longitude BETWEEN :minLon AND :maxLon
34+
AND m.type IN :types
35+
""")
36+
List<Map> findInBoundingBox(
37+
double minLat, double maxLat,
38+
double minLon, double maxLon,
39+
List<PlaceType> types
40+
);
2841
}

0 commit comments

Comments
 (0)