Unified contacts model: Rentman-style type field (company/person), inline addresses, ContactPerson 1:N, all Rentman fields except rental-specific
This commit is contained in:
@@ -128,7 +128,7 @@ async def deep_analysis(
|
||||
extended_context["contact"] = _serialize_row(contact) if contact else None
|
||||
|
||||
elif entity_type == "company":
|
||||
from app.models.company import Company, CompanyContact
|
||||
from app.models.contact import Contact as Company
|
||||
|
||||
comp_result = await db.execute(
|
||||
select(Company)
|
||||
|
||||
@@ -22,8 +22,8 @@ from app.core.cache import get_cache
|
||||
from app.core.db import create_db_session, get_session_factory
|
||||
from app.core.notifications import create_notification
|
||||
from app.models.audit import AuditLog
|
||||
from app.models.company import Company
|
||||
from app.models.contact import CompanyContact, Contact
|
||||
from app.models.contact import Contact as Company
|
||||
from app.models.contact import Contact, ContactPerson
|
||||
from app.plugins.builtins.ai_proactive.models import (
|
||||
ContextLog,
|
||||
ProactiveSettings,
|
||||
@@ -177,9 +177,9 @@ async def gather_context(
|
||||
|
||||
# Company via company_contacts
|
||||
cc_result = await db.execute(
|
||||
select(CompanyContact)
|
||||
.where(CompanyContact.contact_id == entity_id)
|
||||
.where(CompanyContact.tenant_id == tenant_id)
|
||||
select(ContactPerson)
|
||||
.where(ContactPerson.contact_id == entity_id)
|
||||
.where(ContactPerson.tenant_id == tenant_id)
|
||||
.limit(5)
|
||||
)
|
||||
companies: list[dict[str, Any]] = []
|
||||
@@ -279,9 +279,9 @@ async def gather_context(
|
||||
|
||||
# Contacts via company_contacts
|
||||
cc_result = await db.execute(
|
||||
select(CompanyContact)
|
||||
.where(CompanyContact.company_id == entity_id)
|
||||
.where(CompanyContact.tenant_id == tenant_id)
|
||||
select(ContactPerson)
|
||||
.where(ContactPerson.contact_id == entity_id)
|
||||
.where(ContactPerson.tenant_id == tenant_id)
|
||||
)
|
||||
contacts: list[dict[str, Any]] = []
|
||||
for cc in cc_result.scalars().all():
|
||||
|
||||
Reference in New Issue
Block a user