forked from s434786/DINO_SCRUM
fix add endpoint
This commit is contained in:
parent
26c6c0f725
commit
0d4b2dcf75
@ -42,16 +42,15 @@ public class ProductController {
|
|||||||
|
|
||||||
@PostMapping(value = "/product/add")
|
@PostMapping(value = "/product/add")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
String addProduct(@RequestBody Product product){
|
Product addProduct(@RequestBody Product product){
|
||||||
productService.addProduct(product);
|
return productService.addProduct(product);
|
||||||
return "Jak się bawisz Kondradzie?";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping(value = "/product/delete")
|
@DeleteMapping(value = "/product/delete")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
String deleteProduct(@RequestBody IdDto id){
|
String deleteProduct(@RequestBody IdDto id){
|
||||||
productService.deleteProduct(id.getId());
|
productService.deleteProduct(id.getId());
|
||||||
return "(y)";
|
return "Deleted" + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/product/get-by-id")
|
@GetMapping(value = "/product/get-by-id")
|
||||||
|
@ -15,6 +15,6 @@ public interface ProductService {
|
|||||||
Product changeQuantity(QuantityChange quantityChange);
|
Product changeQuantity(QuantityChange quantityChange);
|
||||||
Product getById(Long id);
|
Product getById(Long id);
|
||||||
float getPriceOfAllProducts();
|
float getPriceOfAllProducts();
|
||||||
void addProduct(Product product);
|
Product addProduct(Product product);
|
||||||
void deleteProduct(long id);
|
void deleteProduct(long id);
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addProduct(Product product) {
|
public Product addProduct(Product product) {
|
||||||
productRepository.save(product);
|
return productRepository.save(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user