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.
InvoiceWorkspaceConnector is a direction-discriminated junction row recording which WorkspaceConnector was responsible for creating or routing a given Invoice. Each row carries a direction that distinguishes whether the connector was an input source (data collected into the invoice) or an output router (data distributed from the invoice). Tenant scope is inherited transitively through the Invoice’s workspace relationship and the WorkspaceConnector’s workspace. The table follows the document_workspace_connectors pattern established as the canonical per-entity provenance junction, replacing an earlier rejected targetWorkspaceConnector ManyToOne shape; it ships in parallel with the legacy source_workspace_connector_pk column on the Invoice entity, which will be backfilled and eventually dropped in a future migration.
| Naming | Value |
|---|
| Object | InvoiceWorkspaceConnector |
Resource type (JSON:API type) | invoice_workspace_connector |
| Collection / records root | — (not a records root) |
| REST base | /v1/invoice-workspace-connectors |
| Entity class | InvoiceWorkspaceConnector |
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
| Operation | Method & path | Status |
|---|
| List | GET /v1/invoice-workspace-connectors | 🟡 Planned |
| Retrieve | GET /v1/invoice-workspace-connectors/{id} | 🟡 Planned |
| Create | POST /v1/invoice-workspace-connectors | 🟡 Planned |
| Update | PATCH /v1/invoice-workspace-connectors/{id} | 🟡 Planned |
| Delete | DELETE /v1/invoice-workspace-connectors/{id} | 🟡 Planned |
Data model
Attributes
| Field | Type | Required | Constraints | Allowed values | Description |
|---|
| direction | enum (native: direction_enum) | ✅ Yes | NOT NULL; must be one of the native enum values | ”input” | “output” | Discriminates whether the linked WorkspaceConnector was an input source (data collected into the Invoice) or an output router (data distributed from the Invoice). Stored as the native PostgreSQL enum core_api.direction_enum. |
| created_at | 🔒 system — timestamptz | ✅ Yes | NOT NULL; DEFAULT now() | — | Timestamp set automatically on row creation via MikroORM onCreate hook. Never user-modifiable. |
| updated_at | 🔒 system — timestamptz | ⚪ No | NULL allowed | — | Timestamp set automatically on creation and refreshed on every update via MikroORM onCreate/onUpdate hooks. Nullable — will be null until the first update after creation in practice. |
| deleted_at | 🔒 system — timestamptz | ⚪ No | NULL allowed | — | Soft-delete timestamp. When set, the row is logically deleted. All queries must filter deleted_at IS NULL. Set by the connector sync pipeline or administrative cleanup; never directly user-settable. |
Relationships
| Name | Type | Required | Description |
|---|
| invoice | to-one (ManyToOne) | ✅ Yes | The Invoice this provenance row belongs to. FK invoice_pk → core_api.invoices.pk with ON UPDATE CASCADE. Provides the tenant scope for this row via invoice.workspace. |
| workspaceConnector | to-one (ManyToOne) | ✅ Yes | The WorkspaceConnector responsible for creating or routing this Invoice. FK workspace_connector_pk → core_api.workspace_connectors.pk with ON UPDATE CASCADE. Together with direction, uniquely characterises the connector’s role (input vs. output) for this Invoice. |
System-computed
- created_at — set by MikroORM onCreate hook to the current timestamp at insert time; never written by the user
- updated_at — set by MikroORM onCreate hook at insert and refreshed by onUpdate hook on every subsequent save; never written by the user
- deleted_at — soft-delete marker set by the connector sync pipeline or an administrative cleanup pass; not user-settable
- pk — auto-incremented serial primary key assigned by PostgreSQL at insert; internal join key never exposed on the public API
- No public UUID (*_id) field exists on this entity — the public API references rows through their relationships (invoice_id + workspace_connector_id), not a standalone junction UUID
- Rows are created exclusively by the connector sync pipeline when an Invoice is ingested by or routed through a WorkspaceConnector; no user-facing PATCH route exists for this entity
Example
{
"data": {
"type": "invoice_workspace_connector",
"id": "1047382",
"attributes": {
"direction": "input",
"created_at": "2026-05-10T14:23:11.000Z",
"updated_at": "2026-05-10T14:23:11.000Z",
"deleted_at": null
},
"relationships": {
"invoice": {
"data": { "type": "invoice", "id": "f3a1e2b4-9c87-4d62-b105-002de8f1a234" }
},
"workspace_connector": {
"data": { "type": "workspace_connector", "id": "a9c34f21-1234-4abc-9def-5678def01234" }
}
}
}
}
Source: apps/api/src/database/entities/InvoiceWorkspaceConnector.ts · domain: ingestion · tier: Infrastructure