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 UCSBDiningCommonsMenuItems
  • 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 UCSBDiningCommonsMenuItems
    • 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 - code for each dining common
      name - menu item
      station - which station it is served at
      Returns:
      the saved ucsbdiningcommonsmenuitem
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id)
      Get a single UCSB Dining Commons Menu Item by id
      Parameters:
      id - the id of the UCSB Dining Commons Menu Item
      Returns:
      a UCSB Dining Commons Menu Item
    • updateUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming)
      Update a single UCSB Dining Commons 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 UCSB Dining Commons Menu Item
      Parameters:
      id - the id of the menu item to delete
      Returns:
      a message indicating the menu item was deleted