The job number is stored in the client_booking_reference column 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-07 12:31:07 +00:00
parent 3b9b558628
commit 5286e2a2a2
2 changed files with 11 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import uuid
from sqlmodel import SQLModel, Field, Column, text
from datetime import datetime
from typing import Optional
from sqlalchemy import DateTime
from sqlalchemy import DateTime, String
from sqlalchemy.sql import func
@ -71,8 +71,13 @@ class HubspotDealData(SQLModel, table=True):
confirmed_survey_time: Optional[str] = Field(default=None)
surveyed_date: Optional[datetime] = Field(default=None)
design_type: Optional[str] = Field(default=None)
# OpenHousing job number; HubSpot property ID is client_booking_reference.
job_no: Optional[str] = Field(default=None)
# OpenHousing job number; stored under the same name as the HubSpot
# property that carries it (client_booking_reference) — the column is
# created by the frontend repo's drizzle migration. Only the domain
# calls it job_no.
job_no: Optional[str] = Field(
default=None, sa_column=Column("client_booking_reference", String)
)
survey_type: Optional[str] = Field(default=None)
measures_for_pibi_ordered: Optional[str] = Field(default=None)

View file

@ -63,11 +63,12 @@ def test_the_job_no_is_stored_in_the_client_booking_reference_column(
gateway.record_job_no(deal_id=DEAL_ID, job_no="AD0226519")
# Assert
stored = session.exec( # type: ignore[reportCallOverload]
stored = session.connection().execute(
text(
"select client_booking_reference from hubspot_deal_data "
"where deal_id = :deal_id"
).bindparams(deal_id=DEAL_ID)
),
{"deal_id": DEAL_ID},
).one()
assert stored[0] == "AD0226519"