fix: include owner field when updating a Deck card

Root cause: PUT .../cards/{id} requires 'owner' in the body (undocumented
in the Deck API reference used for the original design) - update_order
only sent title/description/type/order/duedate, so every edit 400'd with
"owner must be provided and must be not empty". Reproduced and verified
against the live Nextcloud instance before fixing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V57jSQPqwkGG8BuAXg59X5
This commit is contained in:
Jonny 2026-09-13 21:09:08 +02:00
parent da48882671
commit 023698b57c
2 changed files with 5 additions and 2 deletions

View File

@ -609,6 +609,7 @@ async def update_order(order_id: int, customer: str = None, description: str = N
"description": description if description is not None else current_card.get("description", ""), "description": description if description is not None else current_card.get("description", ""),
"type": current_card.get("type", "plain"), "type": current_card.get("type", "plain"),
"order": current_card.get("order", 999), "order": current_card.get("order", 999),
"owner": current_card["owner"],
} }
if due_date is not None: if due_date is not None:
body["duedate"] = _as_calendar_local(datetime.fromisoformat(due_date)).isoformat() body["duedate"] = _as_calendar_local(datetime.fromisoformat(due_date)).isoformat()

View File

@ -379,7 +379,7 @@ def test_orders_endpoint_returns_503_on_deck_error(client):
_STACKS_WITH_CARD_55 = [ _STACKS_WITH_CARD_55 = [
{"id": 1, "title": "Offen", "cards": [ {"id": 1, "title": "Offen", "cards": [
{"id": 55, "title": "Feuerwehr Onza", "description": "Helme", "duedate": None, "type": "plain", "order": 999} {"id": 55, "title": "Feuerwehr Onza", "description": "Helme", "duedate": None, "type": "plain", "order": 999, "owner": "jonny"}
]}, ]},
{"id": 2, "title": "In Arbeit", "cards": []}, {"id": 2, "title": "In Arbeit", "cards": []},
{"id": 3, "title": "Erledigt", "cards": []}, {"id": 3, "title": "Erledigt", "cards": []},
@ -407,6 +407,7 @@ async def test_update_order_merges_description_and_keeps_other_fields():
assert body["title"] == "Feuerwehr Onza" assert body["title"] == "Feuerwehr Onza"
assert body["description"] == "20x Handschuhe Groesse L" assert body["description"] == "20x Handschuhe Groesse L"
assert "duedate" not in body assert "duedate" not in body
assert body["owner"] == "jonny"
@pytest.mark.asyncio @pytest.mark.asyncio
@ -426,7 +427,7 @@ async def test_update_order_localizes_new_due_date():
async def test_update_order_keeps_existing_due_date_when_not_given(): async def test_update_order_keeps_existing_due_date_when_not_given():
stacks_with_due_date = [ stacks_with_due_date = [
{"id": 1, "title": "Offen", "cards": [ {"id": 1, "title": "Offen", "cards": [
{"id": 55, "title": "A", "description": "B", "duedate": "2026-09-20T00:00:00+02:00", "type": "plain", "order": 999} {"id": 55, "title": "A", "description": "B", "duedate": "2026-09-20T00:00:00+02:00", "type": "plain", "order": 999, "owner": "someone-else"}
]}, ]},
{"id": 2, "title": "In Arbeit", "cards": []}, {"id": 2, "title": "In Arbeit", "cards": []},
{"id": 3, "title": "Erledigt", "cards": []}, {"id": 3, "title": "Erledigt", "cards": []},
@ -441,6 +442,7 @@ async def test_update_order_keeps_existing_due_date_when_not_given():
_, _, body = put_calls[0].args _, _, body = put_calls[0].args
assert body["duedate"] == "2026-09-20T00:00:00+02:00" assert body["duedate"] == "2026-09-20T00:00:00+02:00"
assert body["title"] == "Neuer Name" assert body["title"] == "Neuer Name"
assert body["owner"] == "someone-else"
@pytest.mark.asyncio @pytest.mark.asyncio