Class MenuItemController

java.lang.Object
edu.ucsb.cs156.dining.controllers.MenuItemController

@RestController @RequestMapping("/api/diningcommons") public class MenuItemController extends Object
Controller for MenuItem
  • Constructor Details

    • MenuItemController

      public MenuItemController()
  • Method Details

    • getMenuItems

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/{dateTime}/{diningCommonsCode}/{meal}") public List<MenuItemDTO> getMenuItems(@PathVariable LocalDateTime dateTime, @PathVariable String diningCommonsCode, @PathVariable String meal)
      Endpoint to fetch all menu items for a specific dining commons, meal, and date. The endpoint saves each menu item in the database and returns their ids, names, and stations.
      Parameters:
      dateTime - the date as ISO 8601 string (e.g., "2024-11-24T00:00:00")
      diningCommonsCode - the code for the dining commons
      meal - the meal code (e.g., "breakfast", "lunch", "dinner")
      Returns:
      a list of MenuItemDTO containing id, name, and station