From 45994a9439fa55ddc1167907c86d8cca412269d4 Mon Sep 17 00:00:00 2001 From: Elias Jansson Date: Wed, 25 Jun 2025 09:19:16 +0200 Subject: [PATCH] Today menu api --- Aberwyn/Controllers/MealMenuApiController.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Aberwyn/Controllers/MealMenuApiController.cs b/Aberwyn/Controllers/MealMenuApiController.cs index ceb16ed..b62d317 100644 --- a/Aberwyn/Controllers/MealMenuApiController.cs +++ b/Aberwyn/Controllers/MealMenuApiController.cs @@ -62,6 +62,23 @@ namespace Aberwyn.Controllers } + [HttpGet("today")] + public IActionResult GetTodayMenu() + { + var today = DateTime.Today; + var menu = _menuService.GetMenuForDate(today); + + if (menu == null) + return NotFound(new { message = "Ingen meny hittades för idag." }); + + return Ok(new + { + date = today.ToString("yyyy-MM-dd"), + lunch = menu.LunchMealName ?? "", + dinner = menu.DinnerMealName ?? "", + breakfast = menu.BreakfastMealName ?? "" + }); + } [HttpPut("menu")]