[31388f42] Final session polish: Refined UI, improved ingest parsing, and completed documentation

This commit is contained in:
2026-03-02 15:10:12 +00:00
parent aa38c555d8
commit ee2dfd5b00
10 changed files with 171 additions and 224 deletions

View File

@@ -647,6 +647,17 @@ def create_contact_endpoint(contact: ContactCreate, db: Session = Depends(get_db
if not company:
raise HTTPException(status_code=404, detail="Company not found")
# Automatic Role Mapping logic
final_role = contact.role
if contact.job_title and not final_role:
role_mapping_service = RoleMappingService(db)
found_role = role_mapping_service.get_role_for_job_title(contact.job_title)
if found_role:
final_role = found_role
else:
# Log unclassified title for future mining
role_mapping_service.add_or_update_unclassified_title(contact.job_title)
# Check if contact with same email already exists for this company
if contact.email:
existing = db.query(Contact).filter(Contact.company_id == contact.company_id, Contact.email == contact.email).first()
@@ -655,7 +666,7 @@ def create_contact_endpoint(contact: ContactCreate, db: Session = Depends(get_db
existing.first_name = contact.first_name
existing.last_name = contact.last_name
existing.job_title = contact.job_title
existing.role = contact.role
existing.role = final_role
db.commit()
db.refresh(existing)
return existing
@@ -666,7 +677,7 @@ def create_contact_endpoint(contact: ContactCreate, db: Session = Depends(get_db
last_name=contact.last_name,
email=contact.email,
job_title=contact.job_title,
role=contact.role,
role=final_role,
is_primary=contact.is_primary,
status="ACTIVE",
unsubscribe_token=str(uuid.uuid4())