mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A scrape that fires Abri triggers builds one message naming the fired flows 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
2e72f32d52
commit
28b4a8927f
1 changed files with 31 additions and 1 deletions
|
|
@ -26,4 +26,34 @@ def build_abri_trigger_message(
|
|||
old_deal: HubspotDealData,
|
||||
) -> Optional[Dict[str, Any]]:
|
||||
"""The Abri trigger message for this scrape, or None if no flow fired."""
|
||||
raise NotImplementedError
|
||||
flows: List[str] = []
|
||||
if HubspotDealDiffer.check_for_abri_job_amendment(
|
||||
new_deal=new_deal, new_project=new_project, old_deal=old_deal
|
||||
):
|
||||
flows.append("amend_job")
|
||||
if HubspotDealDiffer.check_for_abri_job_logging(
|
||||
new_deal=new_deal, new_project=new_project, old_deal=old_deal
|
||||
):
|
||||
flows.append("log_job")
|
||||
if HubspotDealDiffer.check_for_abri_tenant_data_fetch(
|
||||
new_deal=new_deal, new_project=new_project, old_deal=old_deal
|
||||
):
|
||||
flows.append("sync_tenant_data")
|
||||
|
||||
if not flows:
|
||||
return None
|
||||
|
||||
confirmed_survey_date = parse_hs_date(new_deal.get("confirmed_survey_date"))
|
||||
listing = new_listing or {}
|
||||
return {
|
||||
"hubspot_deal_id": hubspot_deal_id,
|
||||
"flows": flows,
|
||||
"place_ref": listing.get("owner_property_id"),
|
||||
"deal_name": new_deal.get("dealname"),
|
||||
"confirmed_survey_date": (
|
||||
confirmed_survey_date.date().isoformat()
|
||||
if confirmed_survey_date is not None
|
||||
else None
|
||||
),
|
||||
"confirmed_survey_time": new_deal.get("confirmed_survey_time"),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue