Update 17 files

- /src/main/resources/application.properties
- /src/main/resources/templates/view-recipe.html
- /src/main/resources/templates/create-recipe.html
- /src/main/resources/templates/home.html
- /src/main/resources/templates/explore.html
- /src/main/resources/templates/public-profile.html
- /src/main/resources/templates/my-profile.html
- /src/main/resources/templates/update-recipe.html
- /src/main/resources/static/css/view-recipe.css
- /src/main/java/com/example/demo/controller/SiteController.java
- /src/main/java/com/example/demo/controller/RecipeUploadController.java
- /src/main/java/com/example/demo/controller/RecipeUploadForm.java
- /src/main/java/com/example/demo/config/WebConfig
- /src/main/java/com/example/demo/config/SecurityConfig.java
- /src/main/java/com/example/demo/config/WebConfig.java
- /src/main/java/com/example/demo/service/Impl/RecipeServiceImpl.java
- /src/main/java/com/example/demo/service/RecipeService.java
This commit is contained in:
Madeleine Stamp
2026-04-21 13:37:02 -06:00
parent ce3cea01c3
commit 267d5c7bdf
17 changed files with 924 additions and 327 deletions
@@ -4,11 +4,16 @@ import java.util.List;
import com.example.demo.service.RecipeService;
import com.example.demo.dto.RecipeDto;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
@Controller
public class SiteController {
@@ -55,6 +60,13 @@ public class SiteController {
return "update-recipe";
}
@GetMapping("/update-recipe/{id}")
public String showUpdateRecipePage(@PathVariable Integer id, Model model) {
RecipeDto recipe = recipeService.getRecipeById(id);
model.addAttribute("recipe", recipe);
return "update-recipe";
}
@GetMapping("/explore")
public String explore(
@RequestParam(required = false) String q,
@@ -70,4 +82,11 @@ public class SiteController {
model.addAttribute("tags", tags);
return "explore";
}
}
@PostMapping("/api/recipes/{id}/image")
@ResponseBody
public ResponseEntity<?> updateRecipeImage(@PathVariable Integer id,
@RequestParam("image") MultipartFile image) {
recipeService.updateRecipeImage(id, image);
return ResponseEntity.ok().build();
}}