CompanyWebLink

CompanyWebLink is a soft-deletable pivot entity that associates a Company with a WebLink (social/web URL). It lives in the core_api schema as company_web_links and acts as the bridge table between companies and their web presence entries. The relationship is navigated from the Company side as the social_links collection. Records are created and managed by the connector sync and enrichment pipelines; there is no user-facing PATCH surface.

NamingValue
ObjectCompanyWebLink
Resource type (JSON:API type)company_web_link
Collection / records rootβ€” (not a records root)
REST base/v1/company-web-links
Entity classCompanyWebLink

Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/company-web-links🟑 Planned
RetrieveGET /v1/company-web-links/{id}🟑 Planned
CreatePOST /v1/company-web-links🟑 Planned
UpdatePATCH /v1/company-web-links/{id}🟑 Planned
DeleteDELETE /v1/company-web-links/{id}🟑 Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
created_atdatetime (πŸ”’ system)βœ… YesNon-null; set on insert only (no onUpdate hook β€” note: updated_at was dropped by Migration20251126135042)β€”Timestamp when this company–web-link association was created. Set automatically on insert via MikroORM onCreate hook; never updated thereafter.
deleted_atdatetime | nullβšͺ NoNullable. Indexed together with company_pk via idx_company_web_links_company_deleted.β€”Soft-delete timestamp. Null means the association is active. Set by the pipeline when a web-link association is removed; never set directly by users.

Relationships

NameTypeRequiredDescription
companyto-one (ManyToOne)βœ… YesThe Company that owns this web-link association. FK company_pk β†’ core_api.companies.pk (ON UPDATE CASCADE). Indexed together with deleted_at via idx_company_web_links_company_deleted for efficient soft-delete-aware array-relationship traversals.
web_linkto-one (ManyToOne)βœ… YesThe WebLink record (URL + platform enum) that this pivot associates with the company. FK web_link_pk β†’ core_api.web_links.pk (ON UPDATE CASCADE). Indexed via idx_company_web_links_web_link.

System-computed

  • created_at β€” set automatically via MikroORM @Property({ onCreate: () => new Date() }); no updated_at (column was dropped by Migration20251126135042)
  • deleted_at β€” set by the pipeline soft-delete path; never hard-deleted in normal operation
  • pk β€” auto-increment serial primary key; internal join key only, never exposed in the API
  • Records are created and managed exclusively by the connector sync / enrichment pipeline when web links are discovered for a company. There is no user-facing create or PATCH route.
  • Composite index idx_company_web_links_company_deleted (company_pk, deleted_at) added by Migration20260416100000 for efficient soft-delete-scoped array-relationship traversals at scale (table had ~7M rows at index creation time)
  • Index idx_company_web_links_web_link (web_link_pk) added by same migration for reverse-direction traversal

Example

{
  "data": {
    "type": "company_web_link",
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "attributes": {
      "created_at": "2025-10-14T09:22:11.000Z",
      "deleted_at": null
    },
    "relationships": {
      "company": {
        "data": { "type": "company", "id": "c9d8e7f6-a5b4-3210-9876-fedcba012345" }
      },
      "web_link": {
        "data": { "type": "web_link", "id": "f0e1d2c3-b4a5-6789-0123-456789abcdef" }
      }
    }
  }
}
Source: apps/api/src/database/entities/CompanyWebLink.ts Β· domain: financial-graph Β· tier: Supporting