Skip to content

Commit 1dac874

Browse files
authored
๐Ÿ“ docs : ์Šค์›จ๊ฑฐ ๋ช…์„ธ ์ž‘์„ฑ
๐Ÿ“ docs : ์Šค์›จ๊ฑฐ ๋ช…์„ธ ์ž‘์„ฑ
2 parents 5b74962 + 1f963b8 commit 1dac874

File tree

5 files changed

+291
-3
lines changed

5 files changed

+291
-3
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
package com.example.Centralthon.domain.menu.web.controller;
2+
3+
import com.example.Centralthon.domain.menu.web.dto.MenuDetailsRes;
4+
import com.example.Centralthon.domain.menu.web.dto.MenuIdsReq;
5+
import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
6+
import com.example.Centralthon.domain.menu.web.dto.StoresByMenuRes;
7+
import com.example.Centralthon.global.response.SuccessResponse;
8+
import io.swagger.v3.oas.annotations.Operation;
9+
import io.swagger.v3.oas.annotations.Parameter;
10+
import io.swagger.v3.oas.annotations.media.Content;
11+
import io.swagger.v3.oas.annotations.media.ExampleObject;
12+
import io.swagger.v3.oas.annotations.media.Schema;
13+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
14+
import io.swagger.v3.oas.annotations.tags.Tag;
15+
import jakarta.validation.Valid;
16+
import org.springframework.http.ResponseEntity;
17+
import org.springframework.web.bind.annotation.RequestBody;
18+
import org.springframework.web.bind.annotation.RequestParam;
19+
20+
import java.util.List;
21+
22+
@Tag(name = "Menus", description = "๋ฐ˜์ฐฌ ๊ด€๋ จ API")
23+
public interface MenuApi {
24+
@Operation(
25+
summary = "๋งž์ถค ์ถ”์ฒœ์šฉ ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ",
26+
description ="์‚ฌ์šฉ์ž ์œ„์น˜ ๊ธฐ์ค€ 2km ์ด๋‚ด์— ๊ฐ€๊ฒŒ์—์„œ ํŒ๋งค์ค‘์ธ ๋ฐ˜์ฐฌ ๋งค๋ฌผ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.<br>"+
27+
"์ค‘๋ณต์„ ์ œ์™ธํ•˜๊ณ  { ๋ฐ˜์ฐฌ๋ช…, ์นดํ…Œ๊ณ ๋ฆฌ }๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
28+
@ApiResponse(
29+
responseCode = "200",
30+
description = "๋งž์ถค ์ถ”์ฒœ์šฉ ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ ์„ฑ๊ณต",
31+
content = @Content(
32+
mediaType = "application/json",
33+
schema = @Schema(implementation = SuccessResponse.class),
34+
examples = @ExampleObject(
35+
name = "SUCCESS_200",
36+
value = """
37+
{
38+
"timestamp": "2025-08-15 04:22:54",
39+
"code": "SUCCESS_200",
40+
"httpStatus": 200,
41+
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
42+
"data": [
43+
{
44+
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
45+
"category" : "STIR_FRY"
46+
},
47+
{
48+
"name": "๋‘๋ถ€ ์กฐ๋ฆผ",
49+
"category" : "BRAISED"
50+
}
51+
],
52+
"isSuccess": true
53+
}
54+
"""
55+
)
56+
)
57+
)
58+
ResponseEntity<SuccessResponse<List<NearbyMenusRes>>> nearbyMenus(
59+
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
60+
@RequestParam("lat") Double lat,
61+
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
62+
@RequestParam("lng") Double lng);
63+
64+
@Operation(
65+
summary = "ํŠน์ • ๋ฉ”๋‰ด ํŒ๋งค ๊ฐ€๊ฒŒ ์กฐํšŒ",
66+
description = "๋ฐ˜์ฐฌ๋ช…์„ ๊ธฐ์ค€์œผ๋กœ ํ•ด๋‹น ๋ฉ”๋‰ด๋ฅผ ํŒ๋งคํ•˜๋Š” ๊ฐ€๊ฒŒ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. ๊ณต๋ฐฑ๊นŒ์ง€ ํฌํ•จํ•˜์—ฌ ๋™์ผ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•ฉ๋‹ˆ๋‹ค.<br>"+
67+
"{ ๋ฉ”๋‰ดId๊ฐ’, ๊ฐ€๊ฒŒ๋ช…, ์‚ฌ์šฉ์ž-๊ฐ€๊ฒŒ ๊ฑฐ๋ฆฌ(km), ํ• ์ธ๊ฐ€, ์ˆ˜๋Ÿ‰}์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
68+
@ApiResponse(
69+
responseCode = "200",
70+
description = "ํŠน์ • ๋ฉ”๋‰ด ํŒ๋งค ๊ฐ€๊ฒŒ ์กฐํšŒ ์„ฑ๊ณต",
71+
content = @Content(
72+
mediaType = "application/json",
73+
schema = @Schema(implementation = SuccessResponse.class),
74+
examples = @ExampleObject(
75+
name = "SUCCESS_200",
76+
value = """
77+
{
78+
"timestamp": "2025-08-15 04:22:54",
79+
"code": "SUCCESS_200",
80+
"httpStatus": 200,
81+
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
82+
"data": [
83+
{
84+
"menuId": 15,
85+
"storeName": "์ดˆ๋ก์ฐฌ ๋น„๊ฑดํ‚ค์นœ",
86+
"distance": 1.7047542239779305,
87+
"salePrice": 4000,
88+
"quantity": 7
89+
},
90+
{
91+
"menuId": 1,
92+
"storeName": "์šฐ์ฐฌ์ด๋„ค ๋ฐ˜์ฐฌ",
93+
"distance": 1.0348092111962985,
94+
"salePrice": 4200,
95+
"quantity": 10
96+
}
97+
],
98+
"isSuccess": true
99+
}
100+
"""
101+
)
102+
)
103+
)
104+
ResponseEntity<SuccessResponse<List<StoresByMenuRes>>> storesByMenu(
105+
@Parameter(name = "name", description = "๋ฉ”๋‰ด ์ด๋ฆ„(๊ณต๋ฐฑ ํฌํ•จํ•˜์—ฌ ์™„์ „์ผ์น˜)", example = "๋‘๋ถ€ ์กฐ๋ฆผ", required = true)
106+
@RequestParam("name") String name,
107+
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
108+
@RequestParam("lat") Double lat,
109+
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
110+
@RequestParam("lng") Double lng);
111+
112+
@Operation(
113+
summary = "๋ฉ”๋‰ด ์ƒ์„ธ ์กฐํšŒ",
114+
description = "์‚ฌ์šฉ์ž๊ฐ€ ์ถ”๊ฐ€ํ•œ ๊ฐ ๋ฉ”๋‰ด๋“ค์˜ ์ƒ์„ธ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.<br>"+
115+
"{๋ฉ”๋‰ดId๊ฐ’, ๋ฉ”๋‰ด ์ด๋ฆ„, ์นดํ…Œ๊ณ ๋ฆฌ, ์›๊ฐ€, ํ• ์ธ๊ฐ€, ํ• ์ธ์œจ, ๊ฐ€๊ฒŒ๋ช…}์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค."
116+
)
117+
@ApiResponse(
118+
responseCode = "200",
119+
description = "๋ฉ”๋‰ด ์ƒ์„ธ ์กฐํšŒ ์„ฑ๊ณต",
120+
content = @Content(
121+
mediaType = "application/json",
122+
schema = @Schema(implementation = SuccessResponse.class),
123+
examples = @ExampleObject(
124+
name = "SUCCESS_200",
125+
value = """
126+
{
127+
"timestamp": "2025-08-15 04:22:54",
128+
"code": "SUCCESS_200",
129+
"httpStatus": 200,
130+
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
131+
"data": [
132+
{
133+
"menuId": 1,
134+
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
135+
"category" : "STIR_FRY",
136+
"costPrice" : 3000,
137+
"salePrice" : 2400,
138+
"salePercent" : 20,
139+
"storeName" : "์šฐ์ฐฌ์ด๋„ค ๋ฐฅ์ƒ"
140+
},
141+
{
142+
"menuId": 4,
143+
"name": "๋‘๋ถ€ ์กฐ๋ฆผ",
144+
"category" : "BRAISED",
145+
"costPrice" : 5000,
146+
"salePrice" : 4000,
147+
"salePercent" : 20,
148+
"storeName" : "ํฌ๋ง ์‹๋‹น"
149+
}
150+
],
151+
"isSuccess": true
152+
}
153+
"""
154+
)
155+
)
156+
)
157+
ResponseEntity<SuccessResponse<List<MenuDetailsRes>>> details(@RequestBody @Valid MenuIdsReq menus);
158+
}

โ€Žsrc/main/java/com/example/Centralthon/domain/menu/web/controller/MenuController.javaโ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.example.Centralthon.domain.menu.service.MenuService;
44

55
import com.example.Centralthon.domain.menu.web.dto.*;
6+
import com.example.Centralthon.domain.order.web.controller.OrderApi;
67
import com.example.Centralthon.global.response.SuccessResponse;
78
import jakarta.validation.Valid;
89

@@ -21,11 +22,12 @@
2122
@RestController
2223
@RequestMapping("/api/menus")
2324
@RequiredArgsConstructor
24-
public class MenuController {
25+
public class MenuController implements MenuApi {
2526
private final MenuService menuService;
2627

2728
//๋งž์ถค ์ถ”์ฒœ์šฉ ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ
2829
@GetMapping("")
30+
@Override
2931
public ResponseEntity<SuccessResponse<List<NearbyMenusRes>>> nearbyMenus(
3032
@RequestParam("lat") Double lat,
3133
@RequestParam("lng") Double lng) {
@@ -37,6 +39,7 @@ public ResponseEntity<SuccessResponse<List<NearbyMenusRes>>> nearbyMenus(
3739

3840
//ํŠน์ • ๋ฉ”๋‰ด๋ฅผ ํŒ๋งค ํ•˜๋Š” ๊ฐ€๊ฒŒ ์กฐํšŒ
3941
@GetMapping("/stores")
42+
@Override
4043
public ResponseEntity<SuccessResponse<List<StoresByMenuRes>>> storesByMenu(
4144
@RequestParam("name") String name,
4245
@RequestParam("lat") Double lat,
@@ -49,6 +52,7 @@ public ResponseEntity<SuccessResponse<List<StoresByMenuRes>>> storesByMenu(
4952

5053
//๋ฉ”๋‰ด ์ƒ์„ธ ์กฐํšŒ
5154
@PostMapping("/details")
55+
@Override
5256
public ResponseEntity<SuccessResponse<List<MenuDetailsRes>>> details(@RequestBody @Valid MenuIdsReq menus){
5357
List<MenuDetailsRes> menuList = menuService.details(menus);
5458

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package com.example.Centralthon.domain.store.web.controller;
2+
3+
import com.example.Centralthon.domain.order.web.dto.CompleteOrderReq;
4+
import com.example.Centralthon.domain.order.web.dto.CreateOrderReq;
5+
import com.example.Centralthon.domain.order.web.dto.CreateOrderRes;
6+
import com.example.Centralthon.domain.store.web.dto.NearbyStoresRes;
7+
import com.example.Centralthon.domain.store.web.dto.StoreMenusRes;
8+
import com.example.Centralthon.global.response.SuccessResponse;
9+
import io.swagger.v3.oas.annotations.Operation;
10+
import io.swagger.v3.oas.annotations.Parameter;
11+
import io.swagger.v3.oas.annotations.enums.ParameterIn;
12+
import io.swagger.v3.oas.annotations.media.Content;
13+
import io.swagger.v3.oas.annotations.media.ExampleObject;
14+
import io.swagger.v3.oas.annotations.media.Schema;
15+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
16+
import io.swagger.v3.oas.annotations.tags.Tag;
17+
import org.springframework.http.ResponseEntity;
18+
import org.springframework.web.bind.annotation.PathVariable;
19+
import org.springframework.web.bind.annotation.RequestParam;
20+
21+
import java.util.List;
22+
23+
@Tag(name = "Stores", description = "๊ฐ€๊ฒŒ ๊ด€๋ จ API")
24+
public interface StoreApi {
25+
@Operation(
26+
summary = "๊ทผ์ฒ˜ ๊ฐ€๊ฒŒ ์œ„์น˜ ๋ชฉ๋ก ์กฐํšŒ",
27+
description = "์‚ฌ์šฉ์ž ์œ„์น˜ ๊ธฐ์ค€ 2km ๋ฐ˜๊ฒฝ ๋‚ด์— ๊ฐ€๊ฒŒ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.<br> ๊ฐ€๊ฒŒ๋“ค์˜ ๊ธฐ๋ณธํ‚ค์™€ ์ขŒํ‘œ๊ฐ’(์œ„๋„, ๊ฒฝ๋„)์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค."
28+
)
29+
@ApiResponse(
30+
responseCode = "200",
31+
description = "๊ทผ์ฒ˜ ๊ฐ€๊ฒŒ ์กฐํšŒ ์„ฑ๊ณต",
32+
content = @Content(
33+
mediaType = "application/json",
34+
schema = @Schema(implementation = SuccessResponse.class),
35+
examples = @ExampleObject(
36+
name = "SUCCESS_200",
37+
value = """
38+
{
39+
"timestamp": "2025-08-14 15:54:04",
40+
"code": "SUCCESS_200",
41+
"httpStatus": 200,
42+
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
43+
"data": [
44+
{
45+
"storeId": 1,
46+
"lat": 37.59,
47+
"lng": 127.0164
48+
},
49+
{
50+
"storeId": 2,
51+
"lat": 37.577,
52+
"lng": 127.0204
53+
}
54+
],
55+
"isSuccess": true
56+
}
57+
"""
58+
)
59+
)
60+
)
61+
ResponseEntity<SuccessResponse<List<NearbyStoresRes>>> nearbyStores(
62+
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
63+
@RequestParam("lat") Double lat,
64+
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
65+
@RequestParam("lng") Double lng);
66+
67+
@Operation(
68+
summary = "๊ฐ€๊ฒŒ์—์„œ ํŒ๋งค ์ค‘์ธ ๋ฉ”๋‰ด ์กฐํšŒ",
69+
description ="ํ˜„์žฌ ์žฌ๊ณ ๊ฐ€ ์žˆ๊ณ  ๋งˆ๊ฐ ๊ธฐํ•œ์„ ๋„˜์ง€ ์•Š์€ ๋ฉ”๋‰ด๋“ค์˜ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. distacne = ์‚ฌ์šฉ์ž์™€ ๊ฐ€๊ฒŒ๊ฐ„์˜ ๊ฑฐ๋ฆฌ(km)<br>" +
70+
"{ ๋ฉ”๋‰ด Id๊ฐ’, ์ด๋ฆ„, ์นดํ…Œ๊ณ ๋ฆฌ, ์›๊ฐ€, ํ• ์ธ๊ฐ€, ํ• ์ธ์œจ, ์ˆ˜๋Ÿ‰} ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
71+
@ApiResponse(
72+
responseCode = "200",
73+
description = "ํŒ๋งค ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ ์„ฑ๊ณต",
74+
content = @Content(
75+
mediaType = "application/json",
76+
schema = @Schema(implementation = SuccessResponse.class),
77+
examples = @ExampleObject(
78+
name = "SUCCESS_200",
79+
value = """
80+
{
81+
"timestamp": "2025-08-15 04:45:14",
82+
"code": "SUCCESS_200",
83+
"httpStatus": 200,
84+
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
85+
"data": {
86+
"name": "์˜ค์ƒ‰ํ“จ์ „์ฐฌ",
87+
"category": "FUSION_SIDE_DISH",
88+
"distance": 1.0419556581490452,
89+
"menus": [
90+
{
91+
"menuId": 4,
92+
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
93+
"category": "STIR_FRY",
94+
"costPrice": 5000,
95+
"salePrice": 4500,
96+
"salePercent": 10,
97+
"quantity": 7
98+
},
99+
{
100+
"menuId": 6,
101+
"name": "์ˆœ๋‘๋ถ€์ฐŒ๊ฐœ",
102+
"category": "SOUP",
103+
"costPrice": 6200,
104+
"salePrice": 5900,
105+
"salePercent": 5,
106+
"quantity": 4
107+
}
108+
]
109+
},
110+
"isSuccess": true
111+
}
112+
"""
113+
)
114+
)
115+
)
116+
ResponseEntity<SuccessResponse<StoreMenusRes>> getStoreMenus(
117+
@Parameter(name = "storeId", in = ParameterIn.PATH, description = "๊ฐ€๊ฒŒ ID", example = "1", required = true)
118+
@PathVariable Long storeId,
119+
@Parameter(name = "lat", in = ParameterIn.QUERY, description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
120+
@RequestParam("lat") Double lat,
121+
@Parameter(name = "lng", in = ParameterIn.QUERY, description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
122+
@RequestParam("lng") Double lng);
123+
}

โ€Žsrc/main/java/com/example/Centralthon/domain/store/web/controller/StoreController.javaโ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.Centralthon.domain.store.web.controller;
22

3+
import com.example.Centralthon.domain.order.web.controller.OrderApi;
34
import com.example.Centralthon.domain.store.service.StoreService;
45
import com.example.Centralthon.domain.store.web.dto.NearbyStoresRes;
56
import com.example.Centralthon.domain.store.web.dto.StoreMenusRes;
@@ -14,11 +15,12 @@
1415
@RestController
1516
@RequestMapping("/api/stores")
1617
@RequiredArgsConstructor
17-
public class StoreController {
18+
public class StoreController implements StoreApi {
1819
private final StoreService storeService;
1920

2021
// ๊ทผ์ฒ˜ ๊ฐ€๊ฒŒ ์œ„์น˜ ๋ชฉ๋ก ์กฐํšŒ
2122
@GetMapping("")
23+
@Override
2224
public ResponseEntity<SuccessResponse<List<NearbyStoresRes>>> nearbyStores(
2325
@RequestParam("lat") Double lat,
2426
@RequestParam("lng") Double lng){
@@ -30,6 +32,7 @@ public ResponseEntity<SuccessResponse<List<NearbyStoresRes>>> nearbyStores(
3032

3133
// ๊ฐ€๊ฒŒ ํŒ๋งค ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ
3234
@GetMapping("/{storeId}/menus")
35+
@Override
3336
public ResponseEntity<SuccessResponse<StoreMenusRes>> getStoreMenus(
3437
@PathVariable Long storeId,
3538
@RequestParam("lat") Double lat,

โ€Žsrc/main/resources/application.propertiesโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spring.jpa.properties.hibernate.format_sql=true
1515
spring.jpa.properties.hibernate.use_sql_comments=true
1616

1717
# Swagger
18-
springdoc.swagger-ui.path=/swagger-ui.html
18+
springdoc.swagger-ui.path=/api/swagger-ui.html
1919
springdoc.api-docs.path=/api-docs
2020
springdoc.group-configs[0].group=default
2121
springdoc.group-configs[0].paths-to-match=/**

0 commit comments

Comments
ย (0)