mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
1.2 KiB
1.2 KiB
Project Memory
HubSpot New Field Addition Process
When adding a new field from HubSpot to the deal table, touch these 4 locations in order:
-
DB model —
backend/app/db/models/organisation.pyAddfield_name: Optional[str] = Field(default=None)toHubspotDealData, near related fields. -
HubSpot API fetch —
etl/hubspot/hubspotClient.py,from_deal_id_get_info()Add the HubSpot internal property name string to theproperties=[...]list. -
Soft check —
etl/hubspot/hubspotDataTodB.py,update_deal_with_checks()Add asoft_assert(deal_in_db.field_name == hs_deal.get("hs_property_name"), "field_name mismatch")entry to thecheckslist. -
Upsert —
etl/hubspot/hubspotDataTodB.py,upsert_deal()- Update branch: add
"field_name": deal_data.get("hs_property_name")to the attr dict - Insert branch: add
field_name=deal_data.get("hs_property_name")to theHubspotDealData(...)constructor
- Update branch: add
Notes:
- Date fields: wrap with
self._parse_hs_date(deal_data.get(...))in steps 3 & 4. - If HubSpot property name differs from DB column name (e.g.
coordination_status__stage_1_→coordination_status), use the HS name in.get()and the DB name as the key/attr.