Class UCSBDiningCommonsMenuItemsController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDiningCommonsMenuItemsController

@RequestMapping("/api/ucsbdiningcommonsmenuitems") @RestController public class UCSBDiningCommonsMenuItemsController extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItem
  • Constructor Details

    • UCSBDiningCommonsMenuItemsController

      public UCSBDiningCommonsMenuItemsController()
  • 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
    • 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 dining commons menu item
      Parameters:
      diningCommonsCode - ; dining commons code as as string
      name - ; name of the item
      station - ; the station
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getUCSBDiningCommonsMenuItem(@RequestParam Long id)
      Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id. If a matching row is found, return the row as a JSON object, otherwise throw an EntityNotFoundException.
      Returns:
      a UCSBDiningCommonsMenuitem JSON object
    • 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 update
      incoming - the new menu item
      Returns:
      the updated menu item object
    • deleteUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id)
      Delete a UCSBDiningCommonsMenuItem
      Parameters:
      id - the id of the menu item to delete
      Returns:
      a message indicating the menu item was deleted