Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt

Use this file to discover all available pages before exploring further.

CompanyCategory is a pivot relation that links a Company to a Category within the Well financial graph. It carries no business attributes beyond the join keys and a creation timestamp, enabling a many-to-many classification of companies by user-defined categories (e.g. “Supplier”, “Client”). Rows are soft-deleted via deleted_at rather than hard-deleted, preserving the audit trail of historical classifications. The entity is written exclusively by the connector-sync and enrichment pipelines; users cannot create or mutate rows through a resource PATCH.
NamingValue
ObjectCompanyCategory
Resource type (JSON:API type)company_category
Collection / records root(not a records root)
REST base/v1/company-categories
Entity classCompanyCategory
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

OperationMethod & pathStatus
ListGET /v1/company-categories🟡 Planned
RetrieveGET /v1/company-categories/{id}🟡 Planned
CreatePOST /v1/company-categories🟡 Planned
UpdatePATCH /v1/company-categories/{id}🟡 Planned
DeleteDELETE /v1/company-categories/{id}🟡 Planned

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
created_at🔒 system — timestamptz✅ YesSet once on INSERT via onCreate hook; never NULLISO-8601 datetimeTimestamp recording when this company–category association was created. Immutable after creation.
deleted_attimestamptz | null⚪ NoNULL means active; non-NULL means soft-deleted. No updated_at present on this entity.ISO-8601 datetime or nullSoft-delete timestamp. Set by the system when the company–category association is removed. All live queries must filter deleted_at IS NULL.

Relationships

NameTypeRequiredDescription
companyto-one (ManyToOne)Yes — NOT NULL FK with ON UPDATE CASCADEThe Company this category is attached to. FK: company_categories.company_pk → companies.pk. A soft-deleted company_category row no longer appears in live queries but the FK is preserved for the audit trail.
categoryto-one (ManyToOne)Yes — NOT NULL FK with ON UPDATE CASCADEThe Category being associated with the company. FK: company_categories.category_pk → categories.pk. Category rows carry a category_type_enum discriminator (e.g. COMPANY, TRANSACTION).

System-computed

  • pk — serial auto-increment integer, internal join key only; never exposed in the public API
  • created_at — set once on INSERT via MikroORM onCreate: () => new Date(); no onUpdate hook exists on this entity
  • deleted_at — written by the system (pipeline or service layer) when the pivot row is logically removed; never user-settable via PATCH
  • No UUID public identifier (company_category_id) exists on this entity — the row is identified exclusively by its compound context (company + category). The JSON:API id is therefore the internal pk.
  • No updated_at column — the entity has no MikroORM onUpdate hook and the migration DDL confirms the column is absent.

Example

{
  "data": {
    "type": "company_category",
    "id": "1",
    "attributes": {
      "created_at": "2025-09-14T08:23:11.000Z",
      "deleted_at": null
    },
    "relationships": {
      "company": {
        "data": { "type": "company", "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
      },
      "category": {
        "data": { "type": "category", "id": "f9e8d7c6-b5a4-3210-fedc-ba9876543210" }
      }
    }
  }
}
Source: apps/api/src/database/entities/CompanyCategory.ts · domain: financial-graph · tier: Supporting