Class UCSBDiningCommonsMenuItemController

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

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

    • UCSBDiningCommonsMenuItemController

      public UCSBDiningCommonsMenuItemController()
  • Method Details

    • allUCSBDiningCommonsMenuItems

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItems()
      List all UCSB Dining Commons Menu Items
      Returns:
      an interable of UCSBDiningCommonsMenuItem
    • 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 menu item
      Returns:
      a UCSBDiningHallMenuItem
    • postUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station)
      Create a dining hall menu item
      Parameters:
      diningCommonsCode - name of the dining hall i.e., 'carrillo'
      name - the name of the menu item
      station - the station the menu item comes from i.e., 'Blue Plate Special'
      Returns:
      the saved ucsbdininghallmenuitem
    • deleteUCSBDiningCommonsMenuItem

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming)
      Update a single dining hall menu item
      Parameters:
      id - id of the menu item to update
      incoming - the menu item
      Returns:
      the updated menu item object