Skip to main content
People is a workspace-scoped entity representing an individual contact — an employee, owner, or other relationship a business interacts with. It is the central node for personal contact data, linked to atomic contact details (emails, phones, locations, web links) through dedicated pivot entities. A People record is connected to one or more Company entities via the CompanyPerson pivot, participates in workspace Membership, and tracks its data-source provenance through the PeopleWorkspaceConnector relation. It is a primary records-page root exposed in the data-views pipeline.

API operations

Data model

Attributes

Relationships

System-computed

  • person_id is generated by PostgreSQL gen_random_uuid() as a column default; unique constraint peoples_person_id_unique enforced at the DB level.
  • created_at is set via MikroORM onCreate lifecycle hook (new Date()); never updated after first persist.
  • updated_at is set on both onCreate and onUpdate via MikroORM lifecycle hooks; reflects the last modification timestamp.
  • deleted_at is null for active records; set to a timestamp on soft-delete. The partial unique index on (external_person_id, workspace_pk) excludes rows where deleted_at IS NOT NULL, allowing soft-deleted records to be re-created with the same external_person_id.
  • external_person_id is the deduplication key for connector-driven sync: if a sync provides an external_person_id already present in the workspace (under the partial unique constraint), the reconciliation pipeline updates the existing record rather than creating a new one.
  • sourceWorkspaceConnector is set by the sync pipeline at creation time to record which WorkspaceConnector produced this record; NULL for manually created people.
  • The @Enrichable decorator on job_title, phones, and webLinks marks these fields as candidates for AI enrichment via the enrichment pipeline (Cloud Tasks workers).
  • Two partial indexes are maintained by migrations for the records-page query path: idx_peoples_workspace_deleted (workspace_pk WHERE deleted_at IS NULL) and idx_peoples_workspace_created_active (workspace_pk, created_at DESC WHERE deleted_at IS NULL) for default sort order.
  • The composite_avatar_fullname composite field (source_fields: person_id, media.url, full_name; display_type: people_avatar_name) is materialized at query time by the data-views pipeline — it is not a persisted column.
  • The sourceWorkspaceConnector.composite_connector_logo_name composite (source_fields: workspace_connector_id, connector.service_id, connector.name; display_type: connector_logo_name) is likewise a query-time composite on the people records root.

Example

Source: apps/api/src/database/entities/People.ts · domain: financial-graph · tier: Main