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 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 common
      name - name of menu item
      station - 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 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 Menu Item
      Parameters:
      id - the id of the Menu Item to delete
      Returns:
      a message indicating the Menu Item was deleted