Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Mono<Ingredient> byId(@PathVariable String id) {
}

@PutMapping("/{id}")
public void updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
public Mono<Ingredient> updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
if (!ingredient.getId().equals(id)) {
throw new IllegalStateException("Given ingredient's ID doesn't match the ID in the path.");
}
repo.save(ingredient);
return repo.save(ingredient);
}

@PostMapping
Expand All @@ -63,8 +63,8 @@ public Mono<ResponseEntity<Ingredient>> postIngredient(@RequestBody Mono<Ingredi
}

@DeleteMapping("/{id}")
public void deleteIngredient(@PathVariable String id) {
repo.deleteById(id);
public Mono<Void> deleteIngredient(@PathVariable String id) {
return repo.deleteById(id);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Mono<Ingredient> byId(@PathVariable String id) {
}

@PutMapping("/{id}")
public void updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
public Mono<Ingredient> updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
if (!ingredient.getId().equals(id)) {
throw new IllegalStateException("Given ingredient's ID doesn't match the ID in the path.");
}
repo.save(ingredient);
return repo.save(ingredient);
}

@PostMapping
Expand All @@ -63,8 +63,8 @@ public Mono<ResponseEntity<Ingredient>> postIngredient(@RequestBody Mono<Ingredi
}

@DeleteMapping("/{id}")
public void deleteIngredient(@PathVariable String id) {
repo.deleteById(id);
public Mono<Void> deleteIngredient(@PathVariable String id) {
return repo.deleteById(id);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Mono<Ingredient> byId(@PathVariable String id) {
}

@PutMapping("/{id}")
public void updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
public Mono<Ingredient> updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
if (!ingredient.getId().equals(id)) {
throw new IllegalStateException("Given ingredient's ID doesn't match the ID in the path.");
}
repo.save(ingredient);
return repo.save(ingredient);
}

@PostMapping
Expand All @@ -63,8 +63,8 @@ public Mono<ResponseEntity<Ingredient>> postIngredient(@RequestBody Mono<Ingredi
}

@DeleteMapping("/{id}")
public void deleteIngredient(@PathVariable String id) {
repo.deleteById(id);
public Mono<Void> deleteIngredient(@PathVariable String id) {
return repo.deleteById(id);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Mono<Ingredient> byId(@PathVariable String id) {
}

@PutMapping("/{id}")
public void updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
public Mono<Ingredient> updateIngredient(@PathVariable String id, @RequestBody Ingredient ingredient) {
if (!ingredient.getId().equals(id)) {
throw new IllegalStateException("Given ingredient's ID doesn't match the ID in the path.");
}
repo.save(ingredient);
return repo.save(ingredient);
}

@PostMapping
Expand All @@ -63,8 +63,8 @@ public Mono<ResponseEntity<Ingredient>> postIngredient(@RequestBody Mono<Ingredi
}

@DeleteMapping("/{id}")
public void deleteIngredient(@PathVariable String id) {
repo.deleteById(id);
public Mono<Void> deleteIngredient(@PathVariable String id) {
return repo.deleteById(id);
}

}