supports lookup by domains
This commit is contained in:
25
sync.py
25
sync.py
@@ -29,6 +29,28 @@ def convert_to_pacific_time(date_str):
|
||||
if not date_str:
|
||||
return ''
|
||||
|
||||
|
||||
def extract_domains_from_emails(emails: List[str]) -> List[str]:
|
||||
"""Extract unique domains from a list of email addresses.
|
||||
|
||||
Args:
|
||||
emails (List[str]): List of email addresses
|
||||
|
||||
Returns:
|
||||
List[str]: List of unique domains extracted from the emails
|
||||
"""
|
||||
if not emails:
|
||||
return []
|
||||
|
||||
domains = set()
|
||||
for email in emails:
|
||||
if email and '@' in email:
|
||||
# Extract domain part after @
|
||||
domain = email.split('@')[1].lower()
|
||||
domains.add(domain)
|
||||
|
||||
return sorted(list(domains))
|
||||
|
||||
try:
|
||||
# Parse the UTC datetime
|
||||
utc_time = datetime.fromisoformat(date_str.replace('Z', '+00:00'))
|
||||
@@ -241,7 +263,8 @@ def process_project(index: int, total: int, project_data: dict, client: Filevine
|
||||
project_name=p.get("projectName") or detail.get("projectName"),
|
||||
project_url=p.get("projectUrl") or detail.get("projectUrl"),
|
||||
#property_contacts=property_contacts
|
||||
viewing_emails = valid_property_managers
|
||||
viewing_emails = valid_property_managers,
|
||||
viewing_domains = extract_domains_from_emails(valid_property_managers)
|
||||
)
|
||||
# Store the results in Firestore
|
||||
from app import db # Import db from app
|
||||
|
||||
Reference in New Issue
Block a user