|
| 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 | +} |
0 commit comments