Class RestaurantsController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.RestaurantsController
@RequestMapping("/api/restaurants")
@RestController
public class RestaurantsController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeleteRestaurant
(Long id) postRestaurant
(String name, String address, String description) updateRestaurant
(Long id, @Valid Restaurant incoming) Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
RestaurantsController
public RestaurantsController()
-
-
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 description) -
deleteRestaurant
-
updateRestaurant
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Restaurant updateRestaurant(@RequestParam Long id, @RequestBody @Valid @Valid Restaurant incoming)
-