minor fix
This commit is contained in:
parent
1d2b52444f
commit
fcab46dccc
@ -82,5 +82,11 @@ public class BookController {
|
||||
@PathVariable(name = "bookId") Long bookId,
|
||||
@PathVariable(name = "authorId") Long authorId) {
|
||||
return bookService.addAuthor(authorId, bookId);
|
||||
}
|
||||
|
||||
@Secured(value = { UserRole.Secured.USER, UserRole.Secured.ADMIN })
|
||||
@GetMapping("/{bookId}/number")
|
||||
public int getBookSubscribersNumber(@PathVariable(name = "bookId") Long bookId) {
|
||||
return bookService.getBookSubscribersNumber(bookId);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ip.library.books.api.BookDto;
|
||||
import com.ip.library.books.model.BookEntity;
|
||||
import com.ip.library.books.service.BookService;
|
||||
import com.ip.library.core.configuration.Constants;
|
||||
import com.ip.library.users.service.UserService;
|
||||
|
||||
@ -20,15 +19,12 @@ import com.ip.library.users.service.UserService;
|
||||
public class UserBookController {
|
||||
private final UserService userService;
|
||||
private final ModelMapper modelMapper;
|
||||
private final BookService bookService;
|
||||
|
||||
public UserBookController(
|
||||
UserService userService,
|
||||
ModelMapper modelMapper,
|
||||
BookService bookService) {
|
||||
ModelMapper modelMapper) {
|
||||
this.userService = userService;
|
||||
this.modelMapper = modelMapper;
|
||||
this.bookService = bookService;
|
||||
}
|
||||
|
||||
private BookDto toBookDto (BookEntity entity) {
|
||||
@ -51,9 +47,4 @@ public class UserBookController {
|
||||
@RequestParam(name = "size", defaultValue = Constants.DEFAULT_PAGE_SIZE) int size) {
|
||||
return userService.getUserFavorities(userId, page, size).stream().map(this::toBookDto).toList();
|
||||
}
|
||||
|
||||
@GetMapping("/{bookId}/number")
|
||||
public int getBookSubscribersNumber(@PathVariable(name = "bookId") Long bookId) {
|
||||
return bookService.getBookSubscribersNumber(bookId);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user