From e73e8ea18e8612f68999b0f54913c77c36354d91 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 2 Apr 2026 10:24:31 +0000 Subject: [PATCH] memory --- MEMORY.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 MEMORY.md diff --git a/MEMORY.md b/MEMORY.md new file mode 100644 index 00000000..5229429e --- /dev/null +++ b/MEMORY.md @@ -0,0 +1,22 @@ +# 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.