implementierung deleteList
This commit is contained in:
1 parent
de72438a0b
commit
844decd963
1 file changed
+8
-1
@@ -7,6 +7,7 @@ import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import de.timaldinger.einkaufsliste.Service.ShoppingListService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -23,6 +24,8 @@ public class ShoppingListController {
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
@Autowired
|
||||
private ShoppingListService shoppingListService;
|
||||
|
||||
@PostMapping("/api/list")
|
||||
public ShoppingListResponseDTO addList(@RequestBody ShoppingListPostDTO newList){
|
||||
@@ -32,5 +35,9 @@ public class ShoppingListController {
|
||||
|
||||
return new ShoppingListResponseDTO(list.getListName(), list.getId());
|
||||
}
|
||||
|
||||
@DeleteMapping("/api/list/{listID}")
|
||||
public ResponseEntity<Void> deleteList(@PathVariable UUID listID){
|
||||
shoppingListService.deleteList(listID);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user