This commit is contained in:
Awen Lelu 2025-12-10 09:50:47 +01:00
parent 3bfb8349a5
commit 0d76bbfe14
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package com.example.demo;
import java.util.ArrayList;
import java.util.UUID;
import lombok.Data;
/**
* Recipe
*/
@Data
public class Recipe {
private UUID id;
private String name;
private ArrayList<String> ingredients;
private String instructions;
}

View File

@ -0,0 +1,41 @@
package com.example.demo;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* HelloController
*/
@RestController
public class RecipeController {
@GetMapping("/recipe")
public List<Recipe> getRecipes() {
Recipe recipe = new Recipe();
recipe.setId(UUID.randomUUID());
recipe.setName("mlem");
recipe.setIngredients(new ArrayList<String>());
recipe.getIngredients().add("test");
recipe.setInstructions("blepo");
// retournes toutes les recettes
ArrayList<Recipe> recipes = new ArrayList<Recipe>();
recipes.add(recipe);
return recipes;
}
@GetMapping("/recipe/{uuid}")
public Recipe getRecipe() {
// retourne une recette
Recipe recipe = new Recipe();
recipe.setId(UUID.randomUUID());
recipe.setName("mlem");
recipe.setIngredients(new ArrayList<String>());
recipe.setInstructions("blepo");
return recipe;
}
}