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")
|
||||
public @ResponseBody
|
||||
String addProduct(@RequestBody Product product){
|
||||
productService.addProduct(product);
|
||||
return "Jak się bawisz Kondradzie?";
|
||||
Product addProduct(@RequestBody Product product){
|
||||
return productService.addProduct(product);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/product/delete")
|
||||
public @ResponseBody
|
||||
String deleteProduct(@RequestBody IdDto id){
|
||||
productService.deleteProduct(id.getId());
|
||||
return "(y)";
|
||||
return "Deleted" + id;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/product/get-by-id")
|
||||
|
@ -15,6 +15,6 @@ public interface ProductService {
|
||||
Product changeQuantity(QuantityChange quantityChange);
|
||||
Product getById(Long id);
|
||||
float getPriceOfAllProducts();
|
||||
void addProduct(Product product);
|
||||
Product addProduct(Product product);
|
||||
void deleteProduct(long id);
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ public class ProductServiceImpl implements ProductService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProduct(Product product) {
|
||||
productRepository.save(product);
|
||||
public Product addProduct(Product product) {
|
||||
return productRepository.save(product);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user