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 UCSBDates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all UCSB datesDelete a UCSBDiningCommonsMenuItemGet a single UCSBDiningCommonsMenuItem by idpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) Create a new dateupdateUCSBDiningCommonsMenuItem
(Long id, @Valid UCSBDiningCommonsMenuItem incoming) Update a single dateMethods 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 dates- Returns:
- an iterable of UCSBDate
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single UCSBDiningCommonsMenuItem by id- Parameters:
id
- the id of the date- Returns:
- a UCSBDiningCommonsMenuItem
-
postUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station) Create a new date- Parameters:
diningCommonsCode
- the dining commons codename
- the name of the menu itemstation
- the station- Returns:
- the saved ucsbdate
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single date- Parameters:
id
- id of the date to updateincoming
- the new ucsbdiningcommonsmenuitem- Returns:
- the updated ucsbdiningcommonsmenuitem object
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a UCSBDiningCommonsMenuItem- Parameters:
id
- the id of the date to delete- Returns:
- a message indicating the date was deleted
-