Class UCSBDiningCommonsMenuItemController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemController
@RequestMapping("/api/ucsbdiningcommonsmenuitem")
@RestController
public class UCSBDiningCommonsMenuItemController
extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItem
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the REST controller. -
Method Summary
Modifier and TypeMethodDescriptionList all UCSB dining commons menu itemsDelete a single dining commons menu itemGet a single dining commons menu item by idpostUCSBDiningCommonsMenuItem(String diningCommonsCode, String name, String station) Create a new dining commons menu itemupdateUCSBDiningCommonsMenuItem(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single dining commons menu itemMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemController
public UCSBDiningCommonsMenuItemController()Default constructor for the REST controller.
-
-
Method Details
-
allUCSBDiningCommonsMenuItems
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItems()List all UCSB dining commons menu items- Returns:
- an iterable of UCSBDiningCommonsMenuItem
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single dining commons menu item by id- Parameters:
id- the id of the menu item- Returns:
- a UCSBDiningCommonsMenuItem
-
postUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station) Create a new dining commons menu item- Parameters:
diningCommonsCode- the code for the dining commonsname- the name of the menu itemstation- the station where the menu item is served- Returns:
- the saved UCSBDiningCommonsMenuItem
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single dining commons menu item- Parameters:
id- the id of the menu item to updateincoming- the new values for the menu item- Returns:
- the updated UCSBDiningCommonsMenuItem
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a single dining commons menu item- Parameters:
id- the id of the menu item to delete- Returns:
- a message indicating the menu item was deleted
-