From ce02ac958b3c041fea263e826acc2b4adac442f8 Mon Sep 17 00:00:00 2001 From: Sagnik Ghosh Date: Fri, 1 May 2026 19:12:21 +0530 Subject: [PATCH] fix: align pipeline cards with client 360 ids --- core/api/api/routes_crm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/api/api/routes_crm.py b/core/api/api/routes_crm.py index aa70953..4716661 100644 --- a/core/api/api/routes_crm.py +++ b/core/api/api/routes_crm.py @@ -454,13 +454,18 @@ def _relative_time_label(value: Any) -> str: def _kanban_stage_payload(stage_id: str, label: str, emoji: str, leads: list[dict[str, Any]]) -> dict[str, Any]: + def lead_route_id(lead: dict[str, Any]) -> str: + metadata = lead.get("metadata") or {} + return str(metadata.get("canonical_person_id") or lead["id"]) + return { "id": stage_id, "label": label, "emoji": emoji, "leads": [ { - "id": lead["id"], + "id": lead_route_id(lead), + "legacyId": lead["id"], "name": lead["name"], "location": lead.get("unit_interest") or lead.get("budget") or lead.get("source"), "qdScore": int(lead.get("score") or 0),