Fix offline sync priority, idempotent check state, and add loading spinner for meal plan import
This commit is contained in:
+6
-2
@@ -47,6 +47,7 @@ from .database import (
|
||||
add_shopping_item,
|
||||
add_shopping_items_bulk,
|
||||
toggle_shopping_item,
|
||||
set_shopping_item_checked,
|
||||
delete_shopping_item,
|
||||
delete_checked_shopping_items,
|
||||
clear_shopping_list,
|
||||
@@ -1075,8 +1076,11 @@ async def api_add_shopping_bulk(payload: ShoppingBulkCreate):
|
||||
|
||||
|
||||
@app.post("/api/shopping-list/{item_id}/toggle")
|
||||
async def api_toggle_shopping_item(item_id: int):
|
||||
updated = toggle_shopping_item(item_id)
|
||||
async def api_toggle_shopping_item(item_id: int, checked: Optional[bool] = Query(None)):
|
||||
if checked is not None:
|
||||
updated = set_shopping_item_checked(item_id, checked)
|
||||
else:
|
||||
updated = toggle_shopping_item(item_id)
|
||||
if not updated:
|
||||
raise HTTPException(status_code=404, detail="Eintrag nicht gefunden.")
|
||||
await shopping_ws_manager.broadcast({"action": "items_updated", "items": get_shopping_list()})
|
||||
|
||||
Reference in New Issue
Block a user