Class ParksController

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

@RequestMapping("/api/parks") @RestController public class ParksController extends ApiController
  • Constructor Details

    • ParksController

      public ParksController()
  • Method Details

    • allParks

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

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Park postPark(@RequestParam String name, @RequestParam String state, @RequestParam int acres) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deletePark

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

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