mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
22 lines
1.2 KiB
Markdown
22 lines
1.2 KiB
Markdown
# Project Memory
|
|
|
|
## HubSpot New Field Addition Process
|
|
|
|
When adding a new field from HubSpot to the deal table, touch these 4 locations in order:
|
|
|
|
1. **DB model** — `backend/app/db/models/organisation.py`
|
|
Add `field_name: Optional[str] = Field(default=None)` to `HubspotDealData`, near related fields.
|
|
|
|
2. **HubSpot API fetch** — `etl/hubspot/hubspotClient.py`, `from_deal_id_get_info()`
|
|
Add the HubSpot internal property name string to the `properties=[...]` list.
|
|
|
|
3. **Soft check** — `etl/hubspot/hubspotDataTodB.py`, `update_deal_with_checks()`
|
|
Add a `soft_assert(deal_in_db.field_name == hs_deal.get("hs_property_name"), "field_name mismatch")` entry to the `checks` list.
|
|
|
|
4. **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 the `HubspotDealData(...)` constructor
|
|
|
|
**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.
|