Phase 1A: Remove company routes/services/models/schemas, unify to Contact

- Removed: app/routes/companies.py, app/services/company_service.py, app/models/company.py, app/schemas/company.py
- Updated: main.py, routes/__init__.py, models/__init__.py (removed company imports)
- Updated: action_mapper.py (company intents → contact intents, /api/v1/companies → /api/v1/contacts)
- Updated: workflows/engine.py (company.created → contact.created)
- Updated: worker.py (removed index_company)
- Updated: roles.py, permission_registry.py, permissions.py, deps.py (companies: → contacts:)
- Updated: permission_registry.py CORE_FIELD_DEFINITIONS (old field names → unified contact fields)
- Updated: address model/schema/service (entity_type company → contact only)
- Updated: ai_copilot_service.py (_exec_companies removed, _exec_contacts extended)
- Updated: ai_proactive services/jobs/context_tools (Company → Contact, company_contacts → contact_persons)
- Updated: unified_search jobs.py (removed index_company), query_understanding.py
- Updated: calendar/models.py, addresses.py docstrings
- Updated: conftest.py (Company → Contact, removed companies/company_contacts from TRUNCATE)
- Updated: test_unified_search.py (index_company → index_contact)
This commit is contained in:
Agent Zero
2026-07-23 17:29:53 +02:00
parent 5d79b4f613
commit b15a62bec6
10 changed files with 55 additions and 56 deletions
+4 -4
View File
@@ -127,7 +127,7 @@ async def deep_analysis(
contact = contact_result.scalar_one_or_none()
extended_context["contact"] = _serialize_row(contact) if contact else None
elif entity_type == "company":
elif entity_type == "contact":
from app.models.contact import Contact as Company
comp_result = await db.execute(
@@ -136,10 +136,10 @@ async def deep_analysis(
.where(Company.tenant_id == tid)
.limit(1)
)
company = comp_result.scalar_one_or_none()
extended_context["company"] = _serialize_row(company) if company else None
contact = comp_result.scalar_one_or_none()
extended_context["contact"] = _serialize_row(contact) if contact else None
# All mails for company
# All mails for contact
mail_result = await db.execute(
select(Mail)
.where(Mail.contact_id == eid)