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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteRestaurant
(String code) postRestaurant
(String code, String name, boolean hasTakeOutMeal, double latitude, double longitude) updateRestaurant
(String code, @Valid Restaurant incoming) Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
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 String code) -
postRestaurant
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Restaurant postRestaurant(@RequestParam String code, @RequestParam String name, @RequestParam boolean hasTakeOutMeal, @RequestParam double latitude, @RequestParam double longitude) -
deleteRestaurant
-
updateRestaurant
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Restaurant updateRestaurant(@RequestParam String code, @RequestBody @Valid @Valid Restaurant incoming)
-