Skip to content

Commit

Permalink
♻️ change RequestParam to ModelAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
hyxrxn committed Jul 24, 2024
1 parent acd6f15 commit 706364d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.pengcook.category.service.CategoryService;
import net.pengcook.recipe.dto.MainRecipeResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -18,11 +19,7 @@ public class CategoryController {
private final CategoryService categoryService;

@GetMapping
public List<MainRecipeResponse> readRecipesOfCategory(
@RequestParam String category,
@RequestParam int pageNumber,
@RequestParam int pageSize) {
RecipeOfCategoryRequest request = new RecipeOfCategoryRequest(category, pageNumber, pageSize);
public List<MainRecipeResponse> readRecipesOfCategory(@ModelAttribute RecipeOfCategoryRequest request) {
return categoryService.readRecipesOfCategory(request);
}
}

0 comments on commit 706364d

Please sign in to comment.