Class CarController

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

@RequestMapping("/api/cars") @RestController public class CarController extends ApiController
  • Constructor Details

    • CarController

      public CarController()
  • Method Details

    • allCars

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

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Car postCar(@RequestParam String make, @RequestParam String model, @RequestParam String year) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteUCSBDate

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

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