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 UCSBDiningCommonsMenuItemController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all UCSB dining commons menu itemsGet a single dining commons menu item by idpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Create a new 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 UCSBDDiningCommonsMenuitem
-
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 commons menu item- Parameters:
diningCommonsCode
- the dining commons codename
- the name of the itemlocalDateTime
- the station at which the item is served- 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
-