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.

Category is a workspace-global catalog entity representing a named classification tag that can be applied to companies or transactions. It is not workspace-scoped itself — it acts as a shared taxonomy that any workspace can reference through the CompanyCategory pivot. A category carries a category_type discriminator (company or transaction) that controls which entity type it may label, and a name string that is the human-visible label.
NamingValue
ObjectCategory
Resource type (JSON:API type)category
Collection / records rootcategories
REST base/v1/categories
Entity classCategory

API operations

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

Data model

Attributes

FieldTypeRequiredConstraintsAllowed valuesDescription
category_idstring, UUID, 🔒 system✅ Yesunique; generated by gen_random_uuid() at insertPublic immutable identifier for the category, used in all API surfaces and relationships.
namestring✅ Yesvarchar(255), NOT NULLHuman-readable label for the category (e.g. ‘SaaS’, ‘Payroll’, ‘Transport’). Must be unique within a given category_type in practice (enforced at the application layer, not at the DB level).
category_typestring (enum)✅ YesNOT NULL; native PG enum core_api.category_type_enum; default ‘company’company | transactionDiscriminator controlling which entity type this category tag applies to. company categories are attached to companies via CompanyCategory; transaction categories label bank transactions.
created_atstring (ISO 8601 datetime), 🔒 system✅ YesNOT NULL; set by MikroORM onCreate lifecycle hookTimestamp of when the category record was first created.
updated_atstring (ISO 8601 datetime), 🔒 system⚪ Nonullable; set by MikroORM onCreate and onUpdate lifecycle hooksTimestamp of the most recent update to this category record.
deleted_atstring (ISO 8601 datetime) | null, 🔒 system⚪ Nonullable; null means activeSoft-delete sentinel. When non-null, the category is considered deleted and must be excluded from all active queries via deleted_at IS NULL predicate.

System-computed

  • category_id is generated at insert by the Postgres expression gen_random_uuid() (defaultRaw). It is unique and immutable.
  • created_at is set by the MikroORM onCreate lifecycle hook to new Date() at insertion time.
  • updated_at is set by both onCreate and onUpdate lifecycle hooks; tracks last modification.
  • deleted_at is null on active records and set to the deletion timestamp on soft-delete. All queries must filter deleted_at IS NULL.
  • category_type defaults to CategoryTypeEnum.COMPANY (‘company’) at the entity level. The DB column carries NOT NULL DEFAULT 'company' via the category_type_enum native PG type added in Migration20260528120000.
  • The partial composite index idx_categories_category_type_active ON core_api.categories (category_type, name) WHERE deleted_at IS NULL is maintained for fast lookup by type within the active catalog.
  • Category is a global (non-workspace-scoped) catalog entity — it has no workspace_pk column. Workspace-level association is achieved exclusively through the CompanyCategory pivot, which joins a workspace-scoped Company to a global Category.
  • Transaction-type catalog entries were seeded by Migration20260528120000 with a fixed list of standard transaction category names (e.g. ‘Payroll’, ‘Rent’, ‘Tax’, etc.).

Example

{
  "data": {
    "type": "category",
    "id": "d4f8a3c1-09b2-4e77-bc3a-f21e6098d5ea",
    "attributes": {
      "category_id": "d4f8a3c1-09b2-4e77-bc3a-f21e6098d5ea",
      "name": "SaaS",
      "category_type": "company",
      "created_at": "2025-09-14T10:23:45.000Z",
      "updated_at": "2025-09-14T10:23:45.000Z",
      "deleted_at": null
    }
  }
}
Source: apps/api/src/database/entities/Category.ts · domain: financial-graph · tier: Supporting