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

    • UCSBDiningCommonsMenuItemController

      public UCSBDiningCommonsMenuItemController()
  • Method Details

    • allUCSBDiningCommonsMenuItems

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

      @PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public org.springframework.http.ResponseEntity<?> getById(@RequestParam Long id)
      Get a single dining commons menu item by id
      Parameters:
      id - the id of the dining commons menu item
      Returns:
      the menu item, or a 404 response with a missing-id message
    • 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 dining commons menu item
      Parameters:
      diningCommonsCode - which hall it is in
      name - the name of the menu item
      station - type of food (entree, desert, etc)
      Returns:
      the saved UCSBDiningCommonsMenuItem
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException