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 UCSB Dining Commons Menu ItemGet a single dining commons menu item by idpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Create a new UCSB Dining Commons 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 dining commons menu item by id- Parameters:
id
- the id of the 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 UCSB Dining Commons Menu Item- Parameters:
diningCommonsCode
- the dining commons code of the itemname
- the name of the itemstation
- the station of the item- Returns:
- the saved UCSBDiningCommonsMenuItem
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
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 id of the itemincoming
- the incoming UCSBDiningCommonsMenuItem- Returns:
- the updated UCSBDiningCommonsMenuItem
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a UCSB Dining Commons Menu Item- Parameters:
id
- the id of the dining commons menu item- Returns:
- a message indicating the item was deleted
-