From c37a453cccdf09a790eae250b8943a7f46384ca3 Mon Sep 17 00:00:00 2001 From: pbg0205 Date: Wed, 28 Apr 2021 16:55:18 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20RequestBody=20=ED=98=95=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=A5=BC=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=EB=B0=9B=EC=95=84=EB=9D=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sidedish/controller/OrderController.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/sidedish/src/main/java/codsquad/team17/sidedish/controller/OrderController.java b/backend/sidedish/src/main/java/codsquad/team17/sidedish/controller/OrderController.java index de56b80cf..48b642288 100644 --- a/backend/sidedish/src/main/java/codsquad/team17/sidedish/controller/OrderController.java +++ b/backend/sidedish/src/main/java/codsquad/team17/sidedish/controller/OrderController.java @@ -3,13 +3,12 @@ import codsquad.team17.sidedish.service.OrderService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; @RestController -@RequestMapping("/order") +@RequestMapping("/dish") public class OrderController { private OrderService orderService; @@ -17,8 +16,8 @@ public OrderController(OrderService orderService) { this.orderService = orderService; } - @PutMapping("/{itemId}/{itemAmount}") - public ResponseEntity orderItem(@PathVariable Long itemId, @PathVariable int itemAmount) { - return new ResponseEntity(orderService.orderItem(itemId, itemAmount), HttpStatus.OK); + @PutMapping("/{itemId}/order") + public ResponseEntity orderItem(@PathVariable Long itemId, @RequestBody HashMap body) { + return new ResponseEntity(orderService.orderItem(itemId, body.get("order_amount")), HttpStatus.OK); } }