feat: complete mealplanner app (backend + frontend + deployment)
.NET 8 backend with Zitadel JWT auth, TheMealDB integration, weekly meal plan generation, shopping list aggregation. Vue 3 + Tailwind 4 frontend with dark emerald theme, manual OIDC PKCE auth, all views implemented. Multi-stage Dockerfile with nginx reverse proxy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
45
backend/Controllers/ShoppingListController.cs
Normal file
45
backend/Controllers/ShoppingListController.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MealPlanner.Services;
|
||||
|
||||
namespace MealPlanner.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/shoppinglist")]
|
||||
[Authorize]
|
||||
public class ShoppingListController(ShoppingListService shoppingListService) : ControllerBase
|
||||
{
|
||||
private string UserId => User.FindFirst("sub")?.Value ?? throw new UnauthorizedAccessException();
|
||||
|
||||
[HttpGet("{mealPlanId:guid}")]
|
||||
public async Task<IActionResult> GetList(Guid mealPlanId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await shoppingListService.GetShoppingListAsync(mealPlanId, UserId);
|
||||
return Ok(items);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
return Forbid();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("{mealPlanId:guid}/check/{itemName}")]
|
||||
public async Task<IActionResult> ToggleCheck(Guid mealPlanId, string itemName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await shoppingListService.ToggleCheckAsync(mealPlanId, itemName, UserId);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
{
|
||||
return NotFound(ex.Message);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
return Forbid();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user