Class RestaurantController

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

@RequestMapping("/api/restaurant") @RestController public class RestaurantController extends ApiController
  • Constructor Details

    • RestaurantController

      public RestaurantController()
  • Method Details

    • allRestaurants

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

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Restaurant postRestaurant(@RequestParam String name, @RequestParam String address, @RequestParam String city, @RequestParam String state, @RequestParam String zip, @RequestParam String description)
    • deleteRestaurant

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

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