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
-
Method Summary
Modifier and TypeMethodDescriptionList all UCSB Dining commons menu itemsDelete a UCSBDiningCommonsMenuItemGet a single menu item by idpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Create a new dining common menu itemupdateUCSBDiningCommonsMenuItem
(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single ucsb dining commons menu itemMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemController
public UCSBDiningCommonsMenuItemController()
-
-
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 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) throws com.fasterxml.jackson.core.JsonProcessingException Create a new dining common menu item- Parameters:
diningCommonsCode
- the dining commons codename
- the name of the menu itemstation
- the station of the menu item- Returns:
- the saved ucsbdiningcommonsmenuitem
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a UCSBDiningCommonsMenuItem- Parameters:
id
- the id of the dining commons menu item to delete- Returns:
- a message indicating the dining commons menu item was deleted
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single ucsb dining commons menu item- Parameters:
id
- the dining commons code- Returns:
- the updated ucsbdiningcommonsmenuitem object
-