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
- created_at — set once by MikroORM onCreate: () => new Date(); never updated afterward (note: no updated_at column on this entity).
- deleted_at — written by soft-delete cascades when the parent Company is soft-deleted; also written by service-layer cleanup when an Email association is explicitly removed.
- Partial-unique index uniq_company_emails_primary_company is maintained by the database engine; enforcement is automatic on INSERT/UPDATE WHERE deleted_at IS NULL AND is_primary IS TRUE.
- The entity has no public UUID (*_id column). It is not directly addressable via the public API; access is always through the parent company’s array relationship (e.g. company_emails on the Company resource).
- Provenance (source_workspace_connector_pk) is not tracked on this entity; rows are written by the enrichment pipeline, connector sync (via reconciliation persister), and direct service-layer mutations — the source is inferred from the parent Company’s sourceWorkspaceConnector if needed.
Example
apps/api/src/database/entities/CompanyEmail.ts · domain: financial-graph · tier: Supporting