Skip to content

Back to master #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ec6b226
completing assignment
bbqboneless Jul 7, 2023
c336b97
Adding repos
bbqboneless Jul 7, 2023
860c1cc
Adding startup page with bootstrap
bbqboneless Jul 13, 2023
efd3775
Refactoring convenient methods: Ingredients, Recipes and bootstrap
bbqboneless Jul 13, 2023
2368bfb
Committed Lombok stuff
bbqboneless Sep 22, 2023
f9cfb5e
Commit Panel Interface
bbqboneless Sep 25, 2023
ffd67cc
Unit Test using Mockito
bbqboneless Sep 25, 2023
7960185
Assignment: Unit Testing the Index Controller
bbqboneless Sep 25, 2023
f5233ea
Just adding Tests
bbqboneless Sep 25, 2023
c95346e
Updating the Recipe Repo and Recipe Service Impl, added the Recipe Co…
bbqboneless Sep 28, 2023
02e561d
Setting up recipe data with Thymeleaf
bbqboneless Sep 28, 2023
4761ee6
Creating a bunch of command, converter and test files that will help …
bbqboneless Oct 3, 2023
b9b2d00
Adding a New Recipe
bbqboneless Oct 4, 2023
c2e4f3d
Updating a Recipe
bbqboneless Oct 4, 2023
bb8aedf
Deleting a Recipe
bbqboneless Oct 4, 2023
dbf224e
View Ingredients
bbqboneless Oct 4, 2023
1e31fae
View and Update Ingredients
bbqboneless Dec 1, 2023
b02774b
New Ingredients
bbqboneless Dec 1, 2023
d615007
Delete Ingredients
bbqboneless Dec 1, 2023
f492815
Refactor some controllers
bbqboneless Dec 5, 2023
86f86af
Image Controller
bbqboneless Dec 5, 2023
bd09741
Images into database
bbqboneless Dec 6, 2023
8531f01
Display images
bbqboneless Dec 6, 2023
2d41da0
Display images - solved
bbqboneless Dec 6, 2023
cd315e9
Recipe Not Found Exception Handling
bbqboneless Dec 14, 2023
82b7c1c
Recipe Not Found Exception Handling with 404 Not Found legend added
bbqboneless Dec 14, 2023
0d9c09b
Add not found id to error handler
bbqboneless Dec 14, 2023
52b24aa
Add not found input string to error handler
bbqboneless Dec 14, 2023
a5cb96f
Make Bad Request error global
bbqboneless Dec 14, 2023
e25cb3d
Adding Constraints into the Recipe Command
bbqboneless Dec 14, 2023
7c1afdc
Updated form to visualize constraint errors
bbqboneless Dec 14, 2023
ac55b14
Added customized messages for constraints
bbqboneless Dec 14, 2023
c2cf1c8
Internationalization
bbqboneless Dec 14, 2023
72cd6bc
Configuration of MySQL
bbqboneless Dec 22, 2023
0a1c73d
Database schema for use
bbqboneless Dec 22, 2023
08b356d
Database schema for use 2
bbqboneless Dec 22, 2023
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
Prev Previous commit
Next Next commit
Refactor some controllers
bbqboneless committed Dec 5, 2023
commit f492815618a9318593abd476fced6f17d25b68f4
Original file line number Diff line number Diff line change
@@ -24,8 +24,7 @@ public IngredientController(RecipeService recipeService, IngredientService ingre
this.unitOfMeasureService = unitOfMeasureService;
}

@GetMapping
@RequestMapping("/recipe/{recipeId}/ingredients")
@GetMapping("/recipe/{recipeId}/ingredients")
public String listIngredients(@PathVariable String recipeId, Model model){
log.debug("Getting ingredient list for recipe id: "+recipeId);

@@ -34,15 +33,13 @@ public String listIngredients(@PathVariable String recipeId, Model model){
return "recipe/ingredient/list";
}

@GetMapping
@RequestMapping("recipe/{recipeId}/ingredient/{id}/show")
@GetMapping("recipe/{recipeId}/ingredient/{id}/show")
public String showRecipeIngredient(@PathVariable String recipeId, @PathVariable String id, Model model){
model.addAttribute("ingredient",ingredientService.findByRecipeIdAndIngredientId(Long.valueOf(recipeId),Long.valueOf(id)));
return "recipe/ingredient/show";
}

@GetMapping
@RequestMapping("recipe/{recipeId}/ingredient/new")
@GetMapping("recipe/{recipeId}/ingredient/new")
public String newIngredient(@PathVariable String recipeId, Model model){
RecipeCommand recipeCommand = recipeService.findCommandById(Long.valueOf(recipeId));

@@ -57,8 +54,7 @@ public String newIngredient(@PathVariable String recipeId, Model model){
return "recipe/ingredient/ingredientform";
}

@GetMapping
@RequestMapping("recipe/{recipeId}/ingredient/{id}/update")
@GetMapping("recipe/{recipeId}/ingredient/{id}/update")
public String updateRecipeIngredient(@PathVariable String recipeId, @PathVariable String id, Model model){
model.addAttribute("ingredient",ingredientService.findByRecipeIdAndIngredientId(Long.valueOf(recipeId), Long.valueOf(id)));
model.addAttribute("uomList",unitOfMeasureService.listAllUoms());
@@ -75,8 +71,7 @@ public String saveOrUpdate(@ModelAttribute IngredientCommand command){
return "redirect:/recipe/" + savedCommand.getRecipeId() + "/ingredient/" + savedCommand.getId() + "/show";
}

@GetMapping
@RequestMapping("recipe/{recipeId}/ingredient/{id}/delete")
@GetMapping("recipe/{recipeId}/ingredient/{id}/delete")
public String deleteIngredient(@PathVariable String recipeId, @PathVariable String id){
log.debug("deleting ingredient id: " + id);
ingredientService.deleteById(Long.valueOf(recipeId), Long.valueOf(id));
Original file line number Diff line number Diff line change
@@ -15,35 +15,30 @@ public class RecipeController {
public RecipeController(RecipeService recipeService) {
this.recipeService = recipeService;
}
@GetMapping
@RequestMapping("/recipe/{id}/show")
@GetMapping("/recipe/{id}/show")
public String showById(@PathVariable String id, Model model){
model.addAttribute("recipe",recipeService.findById(Long.valueOf(id)));
return "recipe/show";
}
@GetMapping
@RequestMapping("recipe/new")
@GetMapping("recipe/new")
public String newRecipe(Model model){
model.addAttribute("recipe", new RecipeCommand());

return "recipe/recipeform";
}
@GetMapping
@RequestMapping("recipe/{id}/update")
@GetMapping("recipe/{id}/update")
public String updateRecipe(@PathVariable String id, Model model){
model.addAttribute("recipe", recipeService.findCommandById(Long.valueOf(id)));
return "recipe/recipeform";
}
@PostMapping
@RequestMapping("recipe")
@PostMapping("recipe")
public String serveOrUpdate(@ModelAttribute RecipeCommand command){
RecipeCommand savedCommand = recipeService.saveRecipeCommand(command);

return "redirect:/recipe/" + savedCommand.getId() + "/show";
}

@GetMapping
@RequestMapping("recipe/{id}/delete")
@GetMapping("recipe/{id}/delete")
public String deleteById(@PathVariable String id){
log.debug("Deleting id: " +id);

8 changes: 7 additions & 1 deletion src/main/resources/templates/recipe/recipeform.html
Original file line number Diff line number Diff line change
@@ -63,7 +63,13 @@ <h1 class="card-title">Edit Recipe Information</h1>
</div>
<div class="col-md-3 form-group">
<label>Difficulty:</label>
<select class="form-control">
<select class="form-control" th:field="*{difficulty}">
<option th:each="difficultyValue : ${T(guru.springframework.domain.Difficulty).values()}"
th:value="${difficultyValue.name()}"
th:text="${difficultyValue.name()}">
val</option>
</select>
<select class="form-control" th:remove="all">
<option>Easy</option>
<option>Medium</option>
<option>Hard</option>