Class UCSBDiningCommonsMenuItemController

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

@RequestMapping("/api/ucsb-dining-commons-menu-items") @RestController public class UCSBDiningCommonsMenuItemController extends ApiController
This is a REST controller for UCSBDiningCommonsMenuItems
  • Constructor Details

    • UCSBDiningCommonsMenuItemController

      public UCSBDiningCommonsMenuItemController()
  • Method Details

    • allUCSBDiningCommonsMenuItems

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItems> allUCSBDiningCommonsMenuItems()
      List all UCSB dining commons menu items
      Returns:
      an iterable of UCSBDiningCommonsMenuItems
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItems getById(@RequestParam Long id)
      Get a single menu item by id
      Parameters:
      id - the id of the menu item
      Returns:
      a UCSBDiningCommonsMenuItems
    • postUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItems postUCSBDiningCommonsMenuItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new menu item
      Parameters:
      diningCommonsCode - the dining commons code
      name - the item name
      station - the station
      Returns:
      the saved ucsb dining commons menu item
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • updateUCSBDiningCommonsMenuItem

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

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