Class BookController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.BookController

@RequestMapping("/api/books") @RestController public class BookController extends ApiController
  • 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)