Добавил кал

This commit is contained in:
maxnes3 2023-05-12 13:17:47 +04:00
parent 059729f986
commit fa6f53bd8a
2 changed files with 22 additions and 0 deletions

View File

@ -36,6 +36,17 @@ public class AuthorController {
return new AuthorDto(authorService.updateAuthor(id, authorDto));
}
@PostMapping("/{id}/Book/{bookId}")
public void addBook(@PathVariable Long id, @PathVariable Long bookId) {
authorService.addBookToAuthor(id, bookId);
}
@DeleteMapping("/{id}/Book/{bookId}")
public void removeBook(@PathVariable Long id, @PathVariable Long bookId)
{
authorService.removeBookFromAuthor(id, bookId);
}
@DeleteMapping("/{id}")
public void deleteAuthor(@PathVariable Long id){
authorService.deleteAuthor(id);

View File

@ -36,6 +36,17 @@ public class BookController {
return new BookDto(bookService.updateBook(id, bookDto));
}
@PostMapping("/{id}/Genre/{genreId}")
public void addGenre(@PathVariable Long id, @PathVariable Long genreId) {
bookService.addGenreToBook(id, genreId);
}
@DeleteMapping("/{id}/Genre/{genreId}")
public void removeGenre(@PathVariable Long id, @PathVariable Long genreId)
{
bookService.removeGenreFromBook(id, genreId);
}
@DeleteMapping("/{id}")
public void deleteBook(@PathVariable Long id){
bookService.deleteBook(id);