Skip to main content
PersonLocation is a pivot (bridge) entity that links a People record to a Location record, recording whether that address is the person’s primary address and whether it serves a legal purpose. It mirrors the company_locations pattern applied to individuals. The entity is workspace-scoped indirectly through its owning People record, carries soft-delete semantics via deleted_at, and enforces a partial-unique constraint ensuring at most one primary address per person among non-deleted rows.
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 integer, internal join key only; never exposed on the public API.
  • created_at — set to new Date() via @Property() on insert; no subsequent updates (no updated_at column on this entity).
  • deleted_at — soft-delete sentinel; null on creation; set by the application soft-delete service, never by user PATCH.
  • Partial unique index uniq_person_locations_primary_person enforces at most one is_primary = TRUE row per person_pk among non-deleted rows — maintained by the database, not application code.
  • The entity has no updated_at column; mutations that change is_primary or label do not produce a timestamp trail beyond created_at.
  • No UUID public id column — PersonLocation does not carry a *_id UUID field; it is identified externally via the combination of person relationship + location relationship.
  • No workspace_pk column — tenant isolation is inherited transitively through the person → workspace path; Hasura RLS walks this relationship chain.

Example

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