Class UCSBDiningCommonsMenuItemController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemController
@RequestMapping("/api/ucsbdiningcommonsmenuitems")
@RestController
public class UCSBDiningCommonsMenuItemController
extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItems
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all UCSB dining commons menu itemsDelete a dining commons menu itemGet a single dining commons menu item by idpostUCSBDiningCommonsMenuItem(String diningCommonsCode, String name, String station) Create a new itemupdateUCSBDiningCommonsMenuItem(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single dining commons menu itemMethods inherited from class 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
-
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 item- Parameters:
diningCommonsCode- the dining commons codename- the name of the itemstation- the station serving the item- Returns:
- the saved item
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
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 dining commons menu item- Returns:
- a 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- id of the dining commons menu item to updateincoming- the new dining commons menu item- Returns:
- the updated dining commons menu item object
-
deleteUCSBDiningCommonsMenuItem
-