""" 1) [completed]Get hubspot deal properties from one deal 2) Put it in some class 3) [completed] Load the db and check if upsert it into the table 4) [completed]Getting working on a AWS lambda 5) [completed] subtask and tasks history 6) [completed]The new sexy deal properties, move it over """ from etl.hubspot.hubspotClient import HubspotClient from etl.hubspot.hubspotDataTodB import HubspotDataToDb from typing import Any # @subtask_handler() TODO: Do this without subtask_handler but task_handler() that creates task_id and subtask_id def handler(body: dict[str, Any], context: Any, local: bool = False) -> None: if local is True: body = { "hubspot_deal_id": "254427203793", } hubspot_deal_id = body.get("hubspot_deal_id", "") if hubspot_deal_id == "": raise RuntimeError( "Missing Hubspot Deal ID in SQS body request, 'hubspot_deal_id'" ) hubspot: HubspotClient = HubspotClient() dbloader: HubspotDataToDb = HubspotDataToDb() deal = dbloader.find_deal_with_deal_id(hubspot_deal_id) if deal: dbloader.update_deal_with_checks(deal, hubspot) else: deal, company, listing = hubspot.get_deal_info_for_db(hubspot_deal_id) dbloader.upsert_deal(deal, company, listing, hubspot) print("Finsihed running")