This commit introduces the foundational elements for the new "Company Explorer" web application, marking a significant step away from the legacy Google Sheets / CLI system. Key changes include: - Project Structure: A new directory with separate (FastAPI) and (React/Vite) components. - Data Persistence: Migration from Google Sheets to a local SQLite database () using SQLAlchemy. - Core Utilities: Extraction and cleanup of essential helper functions (LLM wrappers, text utilities) into . - Backend Services: , , for AI-powered analysis, and logic. - Frontend UI: Basic React application with company table, import wizard, and dynamic inspector sidebar. - Docker Integration: Updated and for multi-stage builds and sideloading. - Deployment & Access: Integrated into central Nginx proxy and dashboard, accessible via . Lessons Learned & Fixed during development: - Frontend Asset Loading: Addressed issues with Vite's path and FastAPI's . - TypeScript Configuration: Added and . - Database Schema Evolution: Solved errors by forcing a new database file and correcting override. - Logging: Implemented robust file-based logging (). This new foundation provides a powerful and maintainable platform for future B2B robotics lead generation.
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
import logging
|
|
import uuid
|
|
from typing import Optional
|
|
from ..interfaces import CRMRepository, LeadData, TaskData
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
class MockRepository(CRMRepository):
|
|
"""
|
|
Simulates a CRM. Use this for local dev or tests.
|
|
Stores data in memory (lost on restart).
|
|
"""
|
|
def __init__(self):
|
|
self._store = {}
|
|
|
|
def get_name(self) -> str:
|
|
return "Local Mock CRM"
|
|
|
|
def find_company(self, name: str, email: str = None) -> Optional[str]:
|
|
# Simple Exact Match Simulation
|
|
for lead_id, lead in self._store.items():
|
|
if lead.name.lower() == name.lower():
|
|
logger.info(f"[MockCRM] Found existing company '{name}' with ID {lead_id}")
|
|
return lead_id
|
|
return None
|
|
|
|
def create_lead(self, lead: LeadData) -> str:
|
|
new_id = f"MOCK_{uuid.uuid4().hex[:8]}"
|
|
self._store[new_id] = lead
|
|
logger.info(f"[MockCRM] Created company '{lead.name}' (ID: {new_id}). Total records: {len(self._store)}")
|
|
return new_id
|
|
|
|
def update_lead(self, external_id: str, lead: LeadData) -> bool:
|
|
if external_id in self._store:
|
|
self._store[external_id] = lead
|
|
logger.info(f"[MockCRM] Updated company {external_id} with robotics score: {lead.robotics_potential_score}")
|
|
return True
|
|
return False
|
|
|
|
def create_task(self, external_id: str, task: TaskData) -> bool:
|
|
logger.info(f"[MockCRM] 🔔 TASK CREATED for {external_id}: '{task.subject}'")
|
|
return True
|