Commit d321aeed authored by Khai Yuan ​Liew's avatar Khai Yuan ​Liew

[AFP-57] Work on PUT product endpoint

parent 66d5f1fc
......@@ -41,16 +41,13 @@ public class ProductController {
return ResponseEntity.ok(productService.findAllProducts());
}
// @PutMapping("/{userId}")
// @PutMapping("/{sku}")
// public Mono<ResponseEntity<Product>> updateProduct(@PathVariable String sku, @RequestBody Product product){
// return productService.updateProductBySku(sku,user)
// .map(updatedProduct -> ResponseEntity.ok(updatedProduct))
// .defaultIfEmpty(ResponseEntity.badRequest().build());
// }
}
@PostMapping("")
public Mono<ProductDto> postProduct(@RequestBody Product product) {
return productService.createProduct(product).onErrorMap(throwable -> new ResourceAlreadyExistsException());
......
......@@ -51,7 +51,6 @@ public class ProductService {
});
}
public Mono<ProductDto> createProduct(Product product) {
return productRepository.save(product)
.map(ProductDto::generateDtoFromProduct);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment