From 1090189ae6797be63186a628ecd705e2efc13b84 Mon Sep 17 00:00:00 2001 From: ohoraming Date: Mon, 8 Aug 2022 14:50:15 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[FE][:wrench:=20FIX:]:=20cart=20api=20metho?= =?UTF-8?q?d=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/frontend/src/apis/cart/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/frontend/src/apis/cart/index.ts b/src/main/frontend/src/apis/cart/index.ts index c164f82..d000286 100644 --- a/src/main/frontend/src/apis/cart/index.ts +++ b/src/main/frontend/src/apis/cart/index.ts @@ -24,7 +24,7 @@ const findCartById = (cid: string) => { const deleteCart = (cid: string) => { return axios - .get(`/api/cart/${cid}`) + .delete(`/api/cart/${cid}`) .then(handleReceiveData) .catch(handleReceiveError); }; From 5f1e59d58713dc94cf4d398de53303665d38041e Mon Sep 17 00:00:00 2001 From: ohoraming Date: Mon, 8 Aug 2022 14:50:34 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[FE][:wrench:=20FIX:]:=20product=20api=20me?= =?UTF-8?q?thod=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/frontend/src/apis/product/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/frontend/src/apis/product/index.ts b/src/main/frontend/src/apis/product/index.ts index ef68e4b..599b357 100644 --- a/src/main/frontend/src/apis/product/index.ts +++ b/src/main/frontend/src/apis/product/index.ts @@ -24,7 +24,7 @@ const findProductById = (pid: string) => { const deleteProduct = (pid: string) => { return axios - .get(`/api/product/${pid}`) + .delete(`/api/product/${pid}`) .then(handleReceiveData) .catch(handleReceiveError); }; From e423cf0880c42c8924ece2fcb1416233ccbb03d7 Mon Sep 17 00:00:00 2001 From: ohoraming Date: Mon, 8 Aug 2022 14:52:39 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[BE][:wrench:=20FIX:]:=20Product=20controll?= =?UTF-8?q?er=20put=20method=20=EC=A4=91=EB=B3=B5=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../narang/web/restController/ProductRestController.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/narang/web/restController/ProductRestController.java b/src/main/java/com/narang/web/restController/ProductRestController.java index 91f9545..e4d2a82 100644 --- a/src/main/java/com/narang/web/restController/ProductRestController.java +++ b/src/main/java/com/narang/web/restController/ProductRestController.java @@ -54,13 +54,7 @@ public ResponseEntity updateProduct(@PathVariable("pid") String id, @RequestB Optional productOptional = productRepository.findById(id); if (productOptional.isPresent()) { Product productToSave = productOptional.get(); - productToSave.setCategory(product.getCategory() != null ? product.getCategory() : productToSave.getCategory()); - productToSave.setName(product.getName() != null ? product.getName() : productToSave.getName()); - productToSave.setPrice(product.getPrice() != null ? product.getPrice() : productToSave.getPrice()); - productToSave.setAmount(product.getAmount() != null ? product.getAmount() : productToSave.getAmount()); - productToSave.setContent(product.getContent() != null ? product.getContent() : productToSave.getContent()); - productToSave.setSeller(product.getSeller() != null ? product.getSeller() : productToSave.getSeller()); - productToSave.setIsSoldOut(product.getIsSoldOut() == true ? product.getIsSoldOut() : productToSave.getIsSoldOut()); + productToSave.replace(product); productRepository.save(productToSave); return new ResponseEntity<>(productToSave, HttpStatus.OK); } else { From 6ab5dab9a99617f286ff1df53eb575ad08165344 Mon Sep 17 00:00:00 2001 From: ohoraming Date: Mon, 8 Aug 2022 14:53:01 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[BE][:wrench:=20FIX:]:=20Product=20controll?= =?UTF-8?q?er=20put=20method=20=EC=A4=91=EB=B3=B5=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/narang/web/entity/Product.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/narang/web/entity/Product.java b/src/main/java/com/narang/web/entity/Product.java index 8b51d4a..a8d3d2c 100644 --- a/src/main/java/com/narang/web/entity/Product.java +++ b/src/main/java/com/narang/web/entity/Product.java @@ -40,4 +40,17 @@ public class Product { @LastModifiedDate private LocalDateTime updates; + + public Product replace(Product compare) { + this.setCategory(compare.getCategory() != null ? compare.getCategory() : this.getCategory()); + this.setName(compare.getName() != null ? compare.getName() : this.getName()); + this.setPrice(compare.getPrice() != null ? compare.getPrice() : this.getPrice()); + this.setAmount(compare.getAmount() != null ? compare.getAmount() : this.getAmount()); + this.setContent(compare.getContent() != null ? compare.getContent() : this.getContent()); + this.setSeller(compare.getSeller() != null ? compare.getSeller() : this.getSeller()); + this.setIsSoldOut(compare.getIsSoldOut() == true ? compare.getIsSoldOut() : this.getIsSoldOut()); + return this; + } } + +