fixed todo delete progatation in recipe
added count to IngredientController about what recipes we have or dont and 2 small typo mistakes also added counting ingredients to IngredientService the pipeline failure is bc i forgot tests exist
This commit is contained in:
parent
16c8d4c6dc
commit
79e7b01363
1 changed files with 8 additions and 3 deletions
|
|
@ -94,6 +94,14 @@ public class IngredientController {
|
|||
*
|
||||
* @see Ingredient
|
||||
*/
|
||||
|
||||
@GetMapping("/ingredients/{id}")
|
||||
public ResponseEntity<Ingredient> getIngredientById(@PathVariable Long id) {
|
||||
return ingredientService.findById(id)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@GetMapping("/ingredients/{id}/usage")
|
||||
public ResponseEntity<IngredientUsageResponse> getIngredientUsage(@PathVariable Long id) {
|
||||
if (ingredientService.findById(id).isEmpty()) {
|
||||
|
|
@ -107,9 +115,6 @@ public class IngredientController {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update an existing ingredient by its ID.
|
||||
* Maps to <code>PATCH /api/ingredients/{id}</code>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue