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 UCSBDingingCommonsMenuItem
  • Constructor Details

    • UCSBDiningCommonsMenuItemController

      public UCSBDiningCommonsMenuItemController()
  • Method Details

    • allUCSBDiningCommonsMenuItems

      @PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItems()
      List all UCSBDiningCommonsMenuItems
      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 - which dining commons the item is at
      name - the name of the item
      station - the station the item is at
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

      @PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id)
      Get a single date by id
      Parameters:
      id - the id of the menu item
      Returns:
      a UCSBDiningCommonsMenuItem
    • 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
    • deleteUCSBUCSBDiningCommonsMenuItem

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