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 UCSBDates
  • 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 UCSB Dining Commons Menu Items
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDiningCommonsMenuItem getById(@RequestParam Long id)
      This method returns a single UCSB Dining Commons Menu Item.
      Parameters:
      id - id of the UCSB Dining Commons Menu Item to get
      Returns:
      a single UCSB Dining Commons Menu Item
    • postUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem(@RequestParam String name, @RequestParam String station, @RequestParam String diningCommonsCode)
      This method creates a new UCSB Dining Commons Menu Item. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      name - name of the UCSB Dining Commons Menu Item
      Returns:
      the save UCSB Dining Commons Menu Item (with it's id field set by the database)
    • deleteUCSBDiningCommonsMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDiningCommonsMenuItem(@RequestParam Long id)
      Deletes a UCSB Dining Commons Menu Item. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      id - id of the UCSB Dining Commons Menu Item to delete
      Returns:
      a message indicating that the UCSB Dining Commons Menu Item was deleted
    • updateRestaurant

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDiningCommonsMenuItem updateRestaurant(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDiningCommonsMenuItem incoming)