Class LaptopsController

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

@RequestMapping("/api/laptops") @RestController public class LaptopsController extends ApiController
  • Constructor Details

    • LaptopsController

      public LaptopsController()
  • Method Details

    • allLaptops

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<Laptop> allLaptops()
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public Laptop getById(@RequestParam Long id)
    • postLaptop

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Laptop postLaptop(@RequestParam String name, @RequestParam String cpu, @RequestParam String gpu, @RequestParam String description)
    • deleteLaptop

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteLaptop(@RequestParam Long id)
    • updateLaptop

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Laptop updateLaptop(@RequestParam Long id, @RequestBody @Valid @Valid Laptop incoming)