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:
@@ -49,7 +49,6 @@ from app.plugins.builtins.unified_search.search_engine import (
|
||||
from app.plugins.builtins.unified_search.jobs import (
|
||||
index_mails,
|
||||
index_contact,
|
||||
index_company,
|
||||
index_event,
|
||||
reindex,
|
||||
embedding_batch,
|
||||
@@ -993,8 +992,8 @@ async def test_index_contact(mock_index_entity, mock_factory, db_session: AsyncS
|
||||
@pytest.mark.asyncio
|
||||
@patch("app.plugins.builtins.unified_search.jobs.get_session_factory")
|
||||
@patch("app.plugins.builtins.unified_search.embedding.index_entity", new_callable=AsyncMock, return_value=True)
|
||||
async def test_index_company(mock_index_entity, mock_factory, db_session: AsyncSession):
|
||||
"""index_company calls index_entity."""
|
||||
async def test_index_contact_company_type(mock_index_entity, mock_factory, db_session: AsyncSession):
|
||||
"""index_contact calls index_entity for company-type contact."""
|
||||
from app.models.contact import Contact as Company
|
||||
from app.models.tenant import Tenant
|
||||
from app.models.user import User
|
||||
@@ -1027,7 +1026,7 @@ async def test_index_company(mock_index_entity, mock_factory, db_session: AsyncS
|
||||
sf = async_sessionmaker(bind=db_session.bind, expire_on_commit=False, class_=AsyncSession)
|
||||
mock_factory.return_value = sf
|
||||
|
||||
await index_company({}, str(company.id))
|
||||
await index_contact({}, str(company.id))
|
||||
mock_index_entity.assert_called()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user