Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package com.example.Centralthon.domain.menu.web.controller;

import com.example.Centralthon.domain.menu.web.dto.MenuDetailsRes;
import com.example.Centralthon.domain.menu.web.dto.MenuIdsReq;
import com.example.Centralthon.domain.menu.web.dto.NearbyMenusRes;
import com.example.Centralthon.domain.menu.web.dto.StoresByMenuRes;
import com.example.Centralthon.global.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Tag(name = "Menus", description = "๋ฐ˜์ฐฌ ๊ด€๋ จ API")
public interface MenuApi {
@Operation(
summary = "๋งž์ถค ์ถ”์ฒœ์šฉ ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ",
description ="์‚ฌ์šฉ์ž ์œ„์น˜ ๊ธฐ์ค€ 2km ์ด๋‚ด์— ๊ฐ€๊ฒŒ์—์„œ ํŒ๋งค์ค‘์ธ ๋ฐ˜์ฐฌ ๋งค๋ฌผ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.<br>"+
"์ค‘๋ณต์„ ์ œ์™ธํ•˜๊ณ  { ๋ฐ˜์ฐฌ๋ช…, ์นดํ…Œ๊ณ ๋ฆฌ }๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
@ApiResponse(
responseCode = "200",
description = "๋งž์ถค ์ถ”์ฒœ์šฉ ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ ์„ฑ๊ณต",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SUCCESS_200",
value = """
{
"timestamp": "2025-08-15 04:22:54",
"code": "SUCCESS_200",
"httpStatus": 200,
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
"data": [
{
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
"category" : "STIR_FRY"
},
{
"name": "๋‘๋ถ€ ์กฐ๋ฆผ",
"category" : "BRAISED"
}
],
"isSuccess": true
}
"""
)
)
)
ResponseEntity<SuccessResponse<List<NearbyMenusRes>>> nearbyMenus(
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
@RequestParam("lat") Double lat,
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
@RequestParam("lng") Double lng);

@Operation(
summary = "ํŠน์ • ๋ฉ”๋‰ด ํŒ๋งค ๊ฐ€๊ฒŒ ์กฐํšŒ",
description = "๋ฐ˜์ฐฌ๋ช…์„ ๊ธฐ์ค€์œผ๋กœ ํ•ด๋‹น ๋ฉ”๋‰ด๋ฅผ ํŒ๋งคํ•˜๋Š” ๊ฐ€๊ฒŒ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. ๊ณต๋ฐฑ๊นŒ์ง€ ํฌํ•จํ•˜์—ฌ ๋™์ผ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•ฉ๋‹ˆ๋‹ค.<br>"+
"{ ๋ฉ”๋‰ดId๊ฐ’, ๊ฐ€๊ฒŒ๋ช…, ์‚ฌ์šฉ์ž-๊ฐ€๊ฒŒ ๊ฑฐ๋ฆฌ(km), ํ• ์ธ๊ฐ€, ์ˆ˜๋Ÿ‰}์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
@ApiResponse(
responseCode = "200",
description = "ํŠน์ • ๋ฉ”๋‰ด ํŒ๋งค ๊ฐ€๊ฒŒ ์กฐํšŒ ์„ฑ๊ณต",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SUCCESS_200",
value = """
{
"timestamp": "2025-08-15 04:22:54",
"code": "SUCCESS_200",
"httpStatus": 200,
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
"data": [
{
"menuId": 15,
"storeName": "์ดˆ๋ก์ฐฌ ๋น„๊ฑดํ‚ค์นœ",
"distance": 1.7047542239779305,
"salePrice": 4000,
"quantity": 7
},
{
"menuId": 1,
"storeName": "์šฐ์ฐฌ์ด๋„ค ๋ฐ˜์ฐฌ",
"distance": 1.0348092111962985,
"salePrice": 4200,
"quantity": 10
}
],
"isSuccess": true
}
"""
)
)
)
ResponseEntity<SuccessResponse<List<StoresByMenuRes>>> storesByMenu(
@Parameter(name = "name", description = "๋ฉ”๋‰ด ์ด๋ฆ„(๊ณต๋ฐฑ ํฌํ•จํ•˜์—ฌ ์™„์ „์ผ์น˜)", example = "๋‘๋ถ€ ์กฐ๋ฆผ", required = true)
@RequestParam("name") String name,
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
@RequestParam("lat") Double lat,
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
@RequestParam("lng") Double lng);

@Operation(
summary = "๋ฉ”๋‰ด ์ƒ์„ธ ์กฐํšŒ",
description = "์‚ฌ์šฉ์ž๊ฐ€ ์ถ”๊ฐ€ํ•œ ๊ฐ ๋ฉ”๋‰ด๋“ค์˜ ์ƒ์„ธ ์ •๋ณด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.<br>"+
"{๋ฉ”๋‰ดId๊ฐ’, ๋ฉ”๋‰ด ์ด๋ฆ„, ์นดํ…Œ๊ณ ๋ฆฌ, ์›๊ฐ€, ํ• ์ธ๊ฐ€, ํ• ์ธ์œจ, ๊ฐ€๊ฒŒ๋ช…}์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค."
)
@ApiResponse(
responseCode = "200",
description = "๋ฉ”๋‰ด ์ƒ์„ธ ์กฐํšŒ ์„ฑ๊ณต",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SUCCESS_200",
value = """
{
"timestamp": "2025-08-15 04:22:54",
"code": "SUCCESS_200",
"httpStatus": 200,
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
"data": [
{
"menuId": 1,
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
"category" : "STIR_FRY",
"costPrice" : 3000,
"salePrice" : 2400,
"salePercent" : 20,
"storeName" : "์šฐ์ฐฌ์ด๋„ค ๋ฐฅ์ƒ"
},
{
"menuId": 4,
"name": "๋‘๋ถ€ ์กฐ๋ฆผ",
"category" : "BRAISED",
"costPrice" : 5000,
"salePrice" : 4000,
"salePercent" : 20,
"storeName" : "ํฌ๋ง ์‹๋‹น"
}
],
"isSuccess": true
}
"""
)
)
)
ResponseEntity<SuccessResponse<List<MenuDetailsRes>>> details(@RequestBody @Valid MenuIdsReq menus);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.Centralthon.domain.menu.service.MenuService;

import com.example.Centralthon.domain.menu.web.dto.*;
import com.example.Centralthon.domain.order.web.controller.OrderApi;
import com.example.Centralthon.global.response.SuccessResponse;
import jakarta.validation.Valid;

Expand All @@ -21,11 +22,12 @@
@RestController
@RequestMapping("/api/menus")
@RequiredArgsConstructor
public class MenuController {
public class MenuController implements MenuApi {
private final MenuService menuService;

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

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package com.example.Centralthon.domain.store.web.controller;

import com.example.Centralthon.domain.order.web.dto.CompleteOrderReq;
import com.example.Centralthon.domain.order.web.dto.CreateOrderReq;
import com.example.Centralthon.domain.order.web.dto.CreateOrderRes;
import com.example.Centralthon.domain.store.web.dto.NearbyStoresRes;
import com.example.Centralthon.domain.store.web.dto.StoreMenusRes;
import com.example.Centralthon.global.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Tag(name = "Stores", description = "๊ฐ€๊ฒŒ ๊ด€๋ จ API")
public interface StoreApi {
@Operation(
summary = "๊ทผ์ฒ˜ ๊ฐ€๊ฒŒ ์œ„์น˜ ๋ชฉ๋ก ์กฐํšŒ",
description = "์‚ฌ์šฉ์ž ์œ„์น˜ ๊ธฐ์ค€ 2km ๋ฐ˜๊ฒฝ ๋‚ด์— ๊ฐ€๊ฒŒ ๋ชฉ๋ก์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.<br> ๊ฐ€๊ฒŒ๋“ค์˜ ๊ธฐ๋ณธํ‚ค์™€ ์ขŒํ‘œ๊ฐ’(์œ„๋„, ๊ฒฝ๋„)์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค."
)
@ApiResponse(
responseCode = "200",
description = "๊ทผ์ฒ˜ ๊ฐ€๊ฒŒ ์กฐํšŒ ์„ฑ๊ณต",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SUCCESS_200",
value = """
{
"timestamp": "2025-08-14 15:54:04",
"code": "SUCCESS_200",
"httpStatus": 200,
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
"data": [
{
"storeId": 1,
"lat": 37.59,
"lng": 127.0164
},
{
"storeId": 2,
"lat": 37.577,
"lng": 127.0204
}
],
"isSuccess": true
}
"""
)
)
)
ResponseEntity<SuccessResponse<List<NearbyStoresRes>>> nearbyStores(
@Parameter(name = "lat", description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
@RequestParam("lat") Double lat,
@Parameter(name = "lng", description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
@RequestParam("lng") Double lng);

@Operation(
summary = "๊ฐ€๊ฒŒ์—์„œ ํŒ๋งค ์ค‘์ธ ๋ฉ”๋‰ด ์กฐํšŒ",
description ="ํ˜„์žฌ ์žฌ๊ณ ๊ฐ€ ์žˆ๊ณ  ๋งˆ๊ฐ ๊ธฐํ•œ์„ ๋„˜์ง€ ์•Š์€ ๋ฉ”๋‰ด๋“ค์˜ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. distacne = ์‚ฌ์šฉ์ž์™€ ๊ฐ€๊ฒŒ๊ฐ„์˜ ๊ฑฐ๋ฆฌ(km)<br>" +
"{ ๋ฉ”๋‰ด Id๊ฐ’, ์ด๋ฆ„, ์นดํ…Œ๊ณ ๋ฆฌ, ์›๊ฐ€, ํ• ์ธ๊ฐ€, ํ• ์ธ์œจ, ์ˆ˜๋Ÿ‰} ์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.")
@ApiResponse(
responseCode = "200",
description = "ํŒ๋งค ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ ์„ฑ๊ณต",
content = @Content(
mediaType = "application/json",
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SUCCESS_200",
value = """
{
"timestamp": "2025-08-15 04:45:14",
"code": "SUCCESS_200",
"httpStatus": 200,
"message": "ํ˜ธ์ถœ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.",
"data": {
"name": "์˜ค์ƒ‰ํ“จ์ „์ฐฌ",
"category": "FUSION_SIDE_DISH",
"distance": 1.0419556581490452,
"menus": [
{
"menuId": 4,
"name": "์ง„๋ฏธ์ฑ„ ๋ณถ์Œ",
"category": "STIR_FRY",
"costPrice": 5000,
"salePrice": 4500,
"salePercent": 10,
"quantity": 7
},
{
"menuId": 6,
"name": "์ˆœ๋‘๋ถ€์ฐŒ๊ฐœ",
"category": "SOUP",
"costPrice": 6200,
"salePrice": 5900,
"salePercent": 5,
"quantity": 4
}
]
},
"isSuccess": true
}
"""
)
)
)
ResponseEntity<SuccessResponse<StoreMenusRes>> getStoreMenus(
@Parameter(name = "storeId", in = ParameterIn.PATH, description = "๊ฐ€๊ฒŒ ID", example = "1", required = true)
@PathVariable Long storeId,
@Parameter(name = "lat", in = ParameterIn.QUERY, description = "์‚ฌ์šฉ์ž ์œ„๋„", example = "37.468355", required = true)
@RequestParam("lat") Double lat,
@Parameter(name = "lng", in = ParameterIn.QUERY, description = "์‚ฌ์šฉ์ž ๊ฒฝ๋„", example = "127.039073", required = true)
@RequestParam("lng") Double lng);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.Centralthon.domain.store.web.controller;

import com.example.Centralthon.domain.order.web.controller.OrderApi;
import com.example.Centralthon.domain.store.service.StoreService;
import com.example.Centralthon.domain.store.web.dto.NearbyStoresRes;
import com.example.Centralthon.domain.store.web.dto.StoreMenusRes;
Expand All @@ -14,11 +15,12 @@
@RestController
@RequestMapping("/api/stores")
@RequiredArgsConstructor
public class StoreController {
public class StoreController implements StoreApi {
private final StoreService storeService;

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

// ๊ฐ€๊ฒŒ ํŒ๋งค ๋ฉ”๋‰ด ๋ชฉ๋ก ์กฐํšŒ
@GetMapping("/{storeId}/menus")
@Override
public ResponseEntity<SuccessResponse<StoreMenusRes>> getStoreMenus(
@PathVariable Long storeId,
@RequestParam("lat") Double lat,
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true

# Swagger
springdoc.swagger-ui.path=/swagger-ui.html
springdoc.swagger-ui.path=/api/swagger-ui.html
springdoc.api-docs.path=/api-docs
springdoc.group-configs[0].group=default
springdoc.group-configs[0].paths-to-match=/**
Expand Down