- MealPlanGrid: edit-mode toggle (visible when >1 meal type) reveals
per-row ↑/↓ reorder and ✕ remove controls; label column expands to
auto width via CSS class swap
- mealPlan store: removeMealType() and reorderMealTypes() — both send
the full updated array to the existing PATCH /meal-plans/{id} endpoint
- MealPlanView: wires remove-meal-type and reorder-meal-types emits;
shares mealTypeAdding loading flag to disable controls during save
- Guard: remove disabled when only one type remains (always keep ≥1)
Slot click now opens an inline editor panel:
- Pick from saved recipes via dropdown (pre-loaded on mount)
- Or type a custom label
- Clear slot button when a slot is already filled
- Save/Cancel with loading state
Add meal type opens a chip picker showing the types not yet active
(breakfast / lunch / snack minus whatever is already on the plan).
Selecting one calls the new PATCH /meal-plans/{plan_id} endpoint.
Backend:
- PATCH /meal-plans/{plan_id} with UpdatePlanRequest(meal_types)
- store.update_meal_plan_types() UPDATE ... RETURNING *
- 409 on IntegrityError in create_plan (already in place)
- Add autoSelectPlan() to the store: after loadPlans() resolves, set
activePlan to the current week's plan (or most recent) without a second
API round-trip -- list already returns full PlanSummary with slots
- Call autoSelectPlan(mondayOfCurrentWeek()) in onMounted so the grid
populates immediately without the user touching the dropdown
- Make onNewPlan idempotent: if a 409 comes back, activate the existing
plan for that week instead of surfacing an error to the user
- Fix sqlite3.OperationalError: the recipes table uses `title` not `name`;
get_plan_slots JOIN was crashing every list_plans call with a 500,
making the + New week button appear broken (plans were being created
silently but the selector refresh always failed)
- Add migration 032 to add UNIQUE INDEX on meal_plans(week_start)
to prevent duplicate plans accumulating while the button was broken
- Raise HTTP 409 on IntegrityError in create_plan so duplicates produce
a clear error instead of a 500
- Fix mondayOfCurrentWeek to build the date string from local date parts
instead of toISOString(), which converts through UTC and can produce the
wrong calendar day for UTC+ timezones
- Add planCreating/planError state to MealPlanView so button shows
"Creating..." during the request and displays errors inline
- update_prep_task: move whitelist guard above filter so invalid column
check runs on raw kwargs (was dead code — set(filtered) - allowed is
always empty); fixes latent SQL injection path for future callers
- main.py: move register_kiwi_programs() into lifespan context manager
so it runs once at startup, not at module import time
- MealPlanView.vue: remove debug console.log stubs from onSlotClick and
onAddMealType (follow-up issue handlers, not ready for production)