Class UCSBDiningCommonsMenuItemController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemController
@RequestMapping("/api/ucsbdiningcommonmenuitem")
@RestController
public class UCSBDiningCommonsMenuItemController
extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItem
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all UCSB Dining Commons Menu ItemsDelete a UCSBDiningCommonsMenuItemGet a menu item by idThis method creates a new diningcommons.updateUCSBDiningCommonsMenuItem
(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single itemMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemController
public UCSBDiningCommonsMenuItemController()
-
-
Method Details
-
allUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItem()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 menu item by id- Parameters:
id
- the id of the menu item- Returns:
- a UCSBDiningCommonMenuItem
-
postItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station) This method creates a new diningcommons. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
diningCommonsCode
- code of the diningcommonsmenuitemname
- name of the diningcommonsmenuitemstation
- station of the diningcommonsmenuitem- Returns:
- the saved diningcommonsmenuitem
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a UCSBDiningCommonsMenuItem- Parameters:
id
- the id of the item to delete- Returns:
- a message indicating the date was deleted
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single item- Parameters:
id
- id of the item to updateincoming
- the new item- Returns:
- the updated item object
-