Fixed usages of delete.
This commit is contained in:
parent
face654aa5
commit
675e2799a5
1 changed files with 3 additions and 2 deletions
|
|
@ -145,10 +145,11 @@ public class RecipeController {
|
|||
@DeleteMapping("/recipe/{id}")
|
||||
public ResponseEntity<Boolean> deleteRecipe(@PathVariable Long id) {
|
||||
logger.info("DELETE /recipe/" + id + " called.");
|
||||
if (!recipeService.delete(id)) {
|
||||
Optional<Recipe> recipe = recipeService.delete(id);
|
||||
if (recipe.isEmpty()) {
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
messagingTemplate.convertAndSend(Topics.RECIPES, new DeleteRecipeMessage(id)); // Send to WS.
|
||||
messagingTemplate.convertAndSend(Topics.RECIPES, new DeleteRecipeMessage(recipe.get())); // Send to WS.
|
||||
return ResponseEntity.ok(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue