Skip to content

Commit

Permalink
Merge pull request #5 from neuefische/kohleru
Browse files Browse the repository at this point in the history
Kohleru
  • Loading branch information
nanunana22 authored Aug 21, 2024
2 parents ad346c8 + d25eda2 commit a42c875
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 16 deletions.
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) {
productRepository.deleteById(id);
}


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

0 comments on commit a42c875

Please sign in to comment.