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 UCSBDiningCommonsMenuItemDelete a UCSBDiningCommonsMenuItemGet a single MenuItem by idpostUCSBDiningCommonsMenuItem(String diningCommonsCode, String name, String station) Create a new UCSBDiningCommonsMenuItemupdateUCSBDiningCommonsMenuItem(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single UCSBDiningCommonsMenuItemMethods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBDiningCommonsMenuItemController
public UCSBDiningCommonsMenuItemController()
-
-
Method Details
-
allUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItem()List all UCSBDiningCommonsMenuItem- Returns:
- an iterable of UCSBDiningCommonsMenuItem
-
getById
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single MenuItem by id- Parameters:
id- the id of the MenuItem- 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 UCSBDiningCommonsMenuItem- Parameters:
diningCommonsCode- the dining commons codename- the name of the menu itemstation- the station where the menu item is served- 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 UCSBDiningCommonsMenuItem to delete- Returns:
- a message indicating the UCSBDiningCommonsMenuItem was deleted
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single UCSBDiningCommonsMenuItem- Parameters:
id- id of the UCSBDiningCommonsMenuItem to updateincoming- the new UCSBDiningCommonsMenuItem- Returns:
- the updated UCSBDiningCommonsMenuItem object
-