mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-18 07:50:25 +00:00
fix: build full_name from parts in chat messages endpoint
- SELECT prefix, given_name, middle_name, family_name, suffix alongside full_name - Apply db._build_full_name() fallback when full_name is NULL - Document the pattern in AGENTS.md to prevent future regressions
This commit is contained in:
+9
-2
@@ -229,14 +229,21 @@ def get_contact_messages(
|
||||
id_clause = "AND id = %s" if where_clause else "WHERE id = %s"
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
f"SELECT full_name FROM contacts {where_clause} {id_clause}",
|
||||
f"""SELECT full_name, prefix, given_name, middle_name, family_name, suffix
|
||||
FROM contacts {where_clause} {id_clause}""",
|
||||
params + [contact_id],
|
||||
)
|
||||
row = cur.fetchone()
|
||||
|
||||
if not row or not row.get("full_name"):
|
||||
if not row:
|
||||
return JSONResponse(status_code=404, content={"detail": "Kontakt nicht gefunden"})
|
||||
|
||||
if not row.get("full_name"):
|
||||
row["full_name"] = db._build_full_name(row)
|
||||
|
||||
if not row.get("full_name"):
|
||||
return JSONResponse(status_code=404, content={"detail": "Kontakt hat keinen Namen"})
|
||||
|
||||
try:
|
||||
resp = requests.get(
|
||||
f"{Config.CHATAPI_URL.rstrip('/')}/conversation",
|
||||
|
||||
Reference in New Issue
Block a user