Add update (CRUD) for events and people; record the full-CRUD invariant
Events and people are now editable, not write-once: PATCH /events/{id} (type, structured date, place, notes) and PATCH /persons/{id} (vitals, privacy, and the primary name's given/surname). CLAUDE.md gains rule #8: every stored object must support full CRUD in API and UI — historical research is constant correction. Tests cover both updates.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Justin Paul <justin@jpaul.me>
This commit is contained in:
@@ -48,6 +48,25 @@ async def test_event_create_list_delete(client):
|
||||
assert len(listed.json()) == 0
|
||||
|
||||
|
||||
async def test_event_update(client):
|
||||
h, tree_id, parent, _ = await _setup_tree_with_two_people(client, "evupd@example.com")
|
||||
eid = (
|
||||
await client.post(
|
||||
f"/api/v1/trees/{tree_id}/events",
|
||||
json={"event_type": "birth", "person_id": parent, "date_value": "1850"},
|
||||
headers=h,
|
||||
)
|
||||
).json()["id"]
|
||||
resp = await client.patch(
|
||||
f"/api/v1/trees/{tree_id}/events/{eid}",
|
||||
json={"date_value": "ABT 1851", "event_type": "baptism"},
|
||||
headers=h,
|
||||
)
|
||||
assert resp.status_code == 200, resp.text
|
||||
assert resp.json()["date_value"] == "ABT 1851"
|
||||
assert resp.json()["event_type"] == "baptism"
|
||||
|
||||
|
||||
async def test_event_requires_exactly_one_subject(client):
|
||||
h, tree_id, _, _ = await _setup_tree_with_two_people(client, "ev2@example.com")
|
||||
resp = await client.post(
|
||||
|
||||
Reference in New Issue
Block a user