mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
got company updates to work
This commit is contained in:
parent
56fe3a1be0
commit
be09749c0a
4 changed files with 21 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ from hubspot.crm.associations.v4.models import ( # type: ignore[reportMissingTy
|
|||
ForwardPaging as AssociationsPaging,
|
||||
NextPage as AssociationsPagingNext,
|
||||
)
|
||||
from etl.hubspot.hubspotDataTodB import CompanyData
|
||||
from etl.hubspot.hubspotDataTodB import CompanyData, HubspotDataToDb
|
||||
|
||||
|
||||
from backend.app.config import get_settings
|
||||
|
|
@ -217,8 +217,15 @@ class HubspotClient:
|
|||
def get_deal_info_for_db(
|
||||
self, deal_id: str
|
||||
) -> tuple[dict[str, str], Optional[str], Optional[dict[str, str]]]:
|
||||
|
||||
deal: dict[str, str] = self.from_deal_id_get_info(deal_id)
|
||||
company: Optional[str] = self.from_deal_id_get_associated_company_id(deal_id)
|
||||
|
||||
if company:
|
||||
company_data: CompanyData = self.get_company_information(company)
|
||||
dbloader: HubspotDataToDb = HubspotDataToDb()
|
||||
dbloader.upsert_company(company_data)
|
||||
|
||||
listing: Optional[dict[str, str]] = self.from_deal_id_get_associated_listing(
|
||||
deal_id
|
||||
)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class HubspotDataToDb:
|
|||
sha256.update(chunk)
|
||||
return sha256.hexdigest()
|
||||
|
||||
def update_deal(self, deal_in_db, hubspot_client):
|
||||
def update_deal(self, deal_in_db, hubspot_client) -> bool:
|
||||
"""
|
||||
Checks if a deal needs updating and syncs it with HubSpot.
|
||||
Also handles major_condition_issue_photos file upload to S3 with integrity check.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
"""
|
||||
README.md
|
||||
|
||||
This is a simple script to showcase how a new organisation can be
|
||||
added to AraDb.
|
||||
|
||||
This has been made reduntant due to doing this process when ever
|
||||
hubspot has a webhook
|
||||
"""
|
||||
|
||||
from etl.hubspot.hubspotClient import HubspotClient, Companies
|
||||
|
||||
from etl.hubspot.hubspotDataTodB import HubspotDataToDb, CompanyData
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ def handler(body: dict[str, Any], context: Any, local: bool = False) -> None:
|
|||
"Missing Hubspot Deal ID in SQS body request, 'hubspot_deal_id'"
|
||||
)
|
||||
|
||||
hubspot = HubspotClient()
|
||||
dbloader = HubspotDataToDb()
|
||||
hubspot: HubspotClient = HubspotClient()
|
||||
dbloader: HubspotDataToDb = HubspotDataToDb()
|
||||
|
||||
deal = dbloader.find_deal_with_deal_id(hubspot_deal_id)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue