Class UCSBDiningCommonsMenuItemController

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

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

    • UCSBDiningCommonsMenuItemController

      public UCSBDiningCommonsMenuItemController()
  • Method Details

    • allUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItem()
      List all UCSB Dining Commons Menu Items
      Returns:
      an iterable of UCSBDiningCommonsMenuItem
    • getById

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postItem(@RequestParam String diningCommonsCode, @RequestParam String name, @RequestParam String station)
      This method creates a new diningcommons. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      diningCommonsCode - code of the diningcommonsmenuitem
      name - name of the diningcommonsmenuitem
      station - station of the diningcommonsmenuitem
      Returns:
      the saved diningcommonsmenuitem
    • 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 date was deleted
    • updateUCSBDiningCommonsMenuItem

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