feat(contacts): freeform company on contacts (nullable company_id + company_name) (PMS-402) #306
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-402-freeform-company-on-contacts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backend for freeform company on contacts (PMS-402), completing the SPA-side MAPPS-251. A contact's company is now optional: it can link an existing CRM company via
company_id, carry a typed-incompany_name, or have neither, with the two forms mutually exclusive (supplying both is a 422). Migration 060 makescontacts.company_idnullable (FK and indexes preserved) and adds a nullablecompany_namecolumn. The create/update/read service paths and the Create/Update/Contact/ContactResponse/ContactRow DTOs are threaded through accordingly; read queries surface a single authoritative name viaCOALESCE(co.name, c.company_name)so the CRM name wins for linked contacts and the freeform value shows otherwise, and setting an FK on update clears any stored freeform name. Covered by new unit tests (freeform-only, FK-only, neither, both-rejected) and integration tests round-tripping a freeform contact and the freeform-to-FK transition.#PMS-402