fix: restore Velocity OS entity and pillar views

This commit is contained in:
2026-05-02 12:13:09 +05:30
parent ce02ac958b
commit 08a19db035
8 changed files with 455 additions and 67 deletions

View File

@@ -740,6 +740,7 @@ async def get_contact(
# ── Client 360 Endpoint ────────────────────────────────────────────────────
@router.get("/crm/client-360/{person_id}", tags=["CRM Client 360"])
@router.get("/crm/leads/{person_id}/360", tags=["CRM Client 360"])
async def client_360(
request: Request,
person_id: str,
@@ -758,6 +759,36 @@ async def client_360(
return {"status": "ok", "data": snapshot}
@router.get("/crm/leads/{person_id}/properties", tags=["CRM Client 360"])
async def legacy_lead_properties(
request: Request,
person_id: str,
user: UserPrincipal = Depends(get_current_user),
) -> Any:
"""Compatibility read for older WebOS builds that requested lead properties directly."""
pool = await _get_pool(request)
async with pool.acquire() as conn:
snapshot = await get_client_360(conn, _tenant_scope(user), person_id)
if not snapshot:
raise HTTPException(status_code=404, detail=f"Client '{person_id}' not found.")
return snapshot.get("property_interests", [])
@router.get("/crm/leads/{person_id}/tasks", tags=["CRM Client 360"])
async def legacy_lead_tasks(
request: Request,
person_id: str,
user: UserPrincipal = Depends(get_current_user),
) -> Any:
"""Compatibility read for older WebOS builds that requested lead tasks directly."""
pool = await _get_pool(request)
async with pool.acquire() as conn:
snapshot = await get_client_360(conn, _tenant_scope(user), person_id)
if not snapshot:
raise HTTPException(status_code=404, detail=f"Client '{person_id}' not found.")
return snapshot.get("tasks", [])
# ── Opportunities Endpoint ─────────────────────────────────────────────────
@router.get("/crm/opportunities", tags=["CRM Opportunities"])