@RequestMapping("/api/books")
@RestController
public class BookController
extends ApiController
-
Constructor Summary
Constructors
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
BookController
public BookController()
-
Method Details
-
allBooks
@PreAuthorize("hasRole(\'ROLE_USER\')")
@GetMapping("/all")
public Iterable<Book> allBooks()
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')")
@GetMapping("")
public Book getById(@RequestParam
Long id)
-
postBooks
@PreAuthorize("hasRole(\'ROLE_ADMIN\')")
@PostMapping("/post")
public Book postBooks(@RequestParam
String name,
@RequestParam
String author,
@RequestParam
String genre)
-
updateBooks
@PreAuthorize("hasRole(\'ROLE_ADMIN\')")
@PutMapping("")
public Book updateBooks(@RequestParam
Long id,
@RequestBody @Valid
@Valid Book incoming)
-
deleteBook
@PreAuthorize("hasRole(\'ROLE_ADMIN\')")
@DeleteMapping("")
public Object deleteBook(@RequestParam
Long id)