Allow partial identity updates
Committed 730a92
--- a/webint_owner/__init__.py
+++ b/webint_owner/__init__.py
@app.query
-def update_details(db, name, nickname, note, uid="/"):
+def update_details(db, name=None, nickname=None, note=None, uid="/"):
"""Update name of identity with given `uid`."""
card = db.select(
"identities",
where="json_extract(identities.card, '$.uid[0]') = ?",
vals=[uid],
)[0]["card"]
- card["name"] = [name]
- card["nickname"] = [nickname]
- card["note"] = [note]
+ if name:
+ card["name"] = [name]
+ if nickname:
+ card["nickname"] = [nickname]
+ if note:
+ card["note"] = [note]
db.update(
"identities",
card=card,