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 Common Menu ItemsDelete a Menu ItemGet a single 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 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 Common Menu Items- Returns:
- an iterable of 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
- dining commons code for which dining commonname
- name of menu itemstation
- station for where in the dining common menu item is- Returns:
- the saved UCSB Dining Common Menu Item
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id) Get a single Menu Item by id- Parameters:
id
- the id of the date- Returns:
- a UCSB Dining Commons Menu Item by ID
-
updateUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming) Update a single Menu Item- Parameters:
id
- id of the Menu Item to updateincoming
- the new Menu Item- Returns:
- the updated Menu Item object
-
deleteUCSBDiningCommonsMenuItem
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id) Delete a Menu Item- Parameters:
id
- the id of the Menu Item to delete- Returns:
- a message indicating the Menu Item was deleted
-