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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDelete a UCSBDateGet a single date by idpostUCSBDiningCommonsMenuItem
(String diningCommonsCode, String name, String station) updaDiningCommonsMenuItem
(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
-
allUCSBDates
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDates() -
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 - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single date by id- Parameters:
id
- the id of the date- Returns:
- a UCSBDate
-
updaDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updaDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single date- Parameters:
id
- id of the date to updateincoming
- the new date- Returns:
- the updated date object
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a UCSBDate- Parameters:
id
- the id of the menu item to delete- Returns:
- a message indicating the menu item was deleted
-