Skip to main content
CompanyRelation models a directed link between two Company entities, capturing structural or commercial relationships (parent/subsidiary hierarchy, supplier chains, client networks). Each tuple records a source company, a target company, and the typed nature of the link. The entity is workspace-adjacent โ€” it is scoped through its Company endpoints rather than carrying a direct workspace FK. Soft-delete support is present via deleted_at; there is no updated_at column on this entity.
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 to new Date() via MikroORM onCreate hook; never written by the caller
  • deleted_at โ€” set by soft-delete logic; never passed in on creation
  • pk โ€” auto-increment serial primary key, internal only; never exposed in the public API
  • source_company_pk / target_company_pk โ€” FK integers resolved from the ManyToOne relations; the public API surfaces these as relationship objects, not raw integers

Example

Source: apps/api/src/database/entities/CompanyRelation.ts ยท domain: financial-graph ยท tier: Supporting