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
Constructors -
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 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) Create a new dining commons menu item- Parameters:
diningCommonsCode- the code of the dining commons (e.g. ortega, de-la-guerra, carrillo, portola)name- the name of the menu itemstation- the station at which the menu item is served- Returns:
- the saved 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:
- the UCSBDiningCommonsMenuItem with the given id
-
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, as a JSON request body containing diningCommonsCode, name and station (e.g. {"diningCommonsCode": "ortega", "name": "Baked Pesto Pasta with Chicken", "station": "Entree Specials"})- Returns:
- the updated UCSBDiningCommonsMenuItem
-
deleteUCSBDiningCommonsMenuItem
-