Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kohleru #5

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.example.backend;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -17,6 +18,13 @@ public class ProductController {
public List<Product> getAllGroceries() {
return productService.findAllGroceries();
}

@DeleteMapping("{id}")
void delete(@PathVariable String id) {
productService.deletebyid(id);
}


@GetMapping("{id}")
public Product getGroceryProductById(@PathVariable String id){
return productService.findGroceriesById(id);
Expand Down
4 changes: 4 additions & 0 deletions backend/src/main/java/org/example/backend/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
public class ProductService {
private final ProductRepository productRepository;

public void deletebyid(String id) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void deletebyid(String id) {
public void deleteById(String id) {

productRepository.deleteById(id);
}


public List<Product> findAllGroceries(){
return productRepository.findAll();
Expand Down
Loading
Loading