minor edits

This commit is contained in:
Zakharov_Rostislav 2024-06-06 22:06:28 +04:00
parent 92414d74c8
commit f97d1984e4

View File

@ -26,6 +26,8 @@ public class UserBookController {
private static final String BOOK_SEARCH_VIEW = "book-search"; private static final String BOOK_SEARCH_VIEW = "book-search";
private static final String USER_FAVORITES_VIEW = "user-favorites"; private static final String USER_FAVORITES_VIEW = "user-favorites";
private static final String PAGE_ATTRIBUTE = "page"; private static final String PAGE_ATTRIBUTE = "page";
private static final String AUTHOR_ATTRIBUTE = "authorId";
private static final String TYPE_ATTRIBUTE = "typeId";
private final UserService userService; private final UserService userService;
private final BookService bookService; private final BookService bookService;
@ -84,8 +86,8 @@ public class UserBookController {
@GetMapping(Constants.API_URL + "/search") @GetMapping(Constants.API_URL + "/search")
public String getAll( public String getAll(
@RequestParam(name = PAGE_ATTRIBUTE, defaultValue = "0") int page, @RequestParam(name = PAGE_ATTRIBUTE, defaultValue = "0") int page,
@RequestParam(name = "typeId", defaultValue = "-1") Long typeId, @RequestParam(name = TYPE_ATTRIBUTE, defaultValue = "-1") Long typeId,
@RequestParam(name = "authorId", defaultValue = "-1") Long authorId, @RequestParam(name = AUTHOR_ATTRIBUTE, defaultValue = "-1") Long authorId,
Model model) { Model model) {
final Map<String, Object> attributes = PageAttributesMapper.toAttributes( final Map<String, Object> attributes = PageAttributesMapper.toAttributes(
bookService.getAll(typeId, authorId, page, Constants.DEFUALT_PAGE_SIZE), bookService.getAll(typeId, authorId, page, Constants.DEFUALT_PAGE_SIZE),