is_primary, is_verify, and label fields so a single person can hold multiple phone numbers under different categories. Records are written by the connector sync pipeline and by user-facing People mutations (add/remove phone); there is no standalone PATCH surface for individual person_phones rows. Soft-delete semantics via deleted_at are enforced, and partial unique indexes guarantee at most one primary phone per person at any time.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
Data model
Attributes
Relationships
System-computed
- pk β auto-increment serial, internal join key only; never exposed in the public API
- created_at β set on INSERT by MikroORM
onCreate: () => new Date()hook; noonUpdatehook exists on this entity (noupdated_atcolumn) - deleted_at β soft-delete field; set to current timestamp when the phone association is removed via People mutation or connector sync; null on active records
- label default β ORM default
PersonPhoneLabelEnum.OTHER(βotherβ) applied on entity construction; also enforced asDEFAULT 'other'in PostgreSQL via the native enum column - is_primary default β ORM default
false; alsoDEFAULT falsein PostgreSQL - is_verify default β ORM default
false; alsoDEFAULT falsein PostgreSQL - Partial unique index
uniq_person_phones_primary_personβ system-enforced constraint preventing more than one primary phone per person among non-deleted rows; managed at DB level, not ORM level
Example
apps/api/src/database/entities/PersonPhone.ts Β· domain: financial-graph Β· tier: Supporting