> ## 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.

# PeopleWorkspaceConnector

> PeopleWorkspaceConnector is a direction-discriminated junction table that records per-row provenance between a `People` record and a `WorkspaceConnector` instan

PeopleWorkspaceConnector is a direction-discriminated junction table that records per-row provenance between a `People` record and a `WorkspaceConnector` instance. Each row answers the question "which connector sourced or consumed this person, and in which direction?" — `input` for connectors that delivered the record into Well, `output` for connectors that received it from Well. Tenant isolation is inherited transitively through the `People.workspace` and `WorkspaceConnector.workspace` relationships; there is no direct `workspace_pk` column on the junction itself. The table was introduced in Migration20260505200000 as part of a five-entity junction pattern (W19 PR-A1), following the `document_workspace_connectors` precedent.

| Naming                          | Value                             |
| ------------------------------- | --------------------------------- |
| Object                          | PeopleWorkspaceConnector          |
| Resource type (JSON:API `type`) | `people_workspace_connector`      |
| Collection / records root       | — <sub>(not a records root)</sub> |
| REST base                       | `/v1/people-workspace-connectors` |
| Entity class                    | `PeopleWorkspaceConnector`        |

<Note>
  **Internal object.** Not currently exposed on the public REST API. The operations below describe the intended contract.
</Note>

## API operations

| Operation | Method & path                                 | Status     |
| --------- | --------------------------------------------- | ---------- |
| List      | `GET /v1/people-workspace-connectors`         | 🟡 Planned |
| Retrieve  | `GET /v1/people-workspace-connectors/{id}`    | 🟡 Planned |
| Create    | `POST /v1/people-workspace-connectors`        | 🟡 Planned |
| Update    | `PATCH /v1/people-workspace-connectors/{id}`  | 🟡 Planned |
| Delete    | `DELETE /v1/people-workspace-connectors/{id}` | 🟡 Planned |

## Data model

### Attributes

| Field       | Type                                                        | Required | Constraints                                                                            | Allowed values      | Description                                                                                                                                                                                      |
| ----------- | ----------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| direction   | 🔒 system — DirectionEnum (native PG enum `direction_enum`) | ✅ Yes    | NOT NULL; CHECK via PG enum type — stored values are the enum VALUE strings            | `input` \| `output` | Classifies the connector's role for this person: `input` means the connector delivered (sourced) the record into Well; `output` means the connector consumed (distributed) the record from Well. |
| created\_at | 🔒 system — timestamptz                                     | ✅ Yes    | NOT NULL; default now(); set once on INSERT via MikroORM `onCreate` hook               | —                   | Timestamp of row insertion. Set automatically by the ORM on create; never updated thereafter.                                                                                                    |
| updated\_at | 🔒 system — timestamptz                                     | ⚪ No     | Nullable; set on INSERT and on every UPDATE via MikroORM `onCreate` / `onUpdate` hooks | —                   | Timestamp of the most recent mutation. Maintained automatically by the ORM.                                                                                                                      |
| deleted\_at | 🔒 system — timestamptz                                     | ⚪ No     | Nullable; NULL = active row; non-NULL = soft-deleted                                   | —                   | Soft-delete timestamp. When set, the row is treated as logically deleted and filtered from normal queries.                                                                                       |

### Relationships

| Name               | Type               | Required | Description                                                                                                                                                                  |
| ------------------ | ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| people             | to-one (ManyToOne) | ✅ Yes    | The `People` record this junction row links. FK column `people_pk` references `core_api.peoples.pk` ON UPDATE CASCADE. Tenant isolation is inherited via `People.workspace`. |
| workspaceConnector | to-one (ManyToOne) | ✅ Yes    | The `WorkspaceConnector` instance that sourced or consumed this person. FK column `workspace_connector_pk` references `core_api.workspace_connectors.pk` ON UPDATE CASCADE.  |

### System-computed

* pk — auto-increment serial primary key, internal only; never exposed on the public API
* created\_at — set to `new Date()` on INSERT via MikroORM `onCreate: () => new Date()` hook; PG column default is `now()`
* updated\_at — set on INSERT and updated on every subsequent mutation via MikroORM `onCreate` / `onUpdate` hooks
* deleted\_at — soft-delete sentinel; injected as NULL on INSERT; set by the connector sync orchestrator when a provenance link is invalidated or the connector is disconnected
* Tenant isolation is not a stored column on this table — it is derived transitively through `people.workspace_pk` and `workspace_connector.workspace_pk`; Hasura RLS uses relationship traversal rather than a direct workspace\_pk filter
* No UNIQUE constraint on (people\_pk, workspace\_connector\_pk, direction) — duplicate rows are an accepted design gap per the W19 migration rationale; deduplication is deferred to a future iteration
* Two composite B-tree indexes: `idx_people_workspace_connectors_record_created` on (people\_pk, created\_at) for record-led traversals; `idx_people_workspace_connectors_wc_created_at` on (workspace\_connector\_pk, created\_at) for sync-status range queries

## Example

```json theme={null}
{
  "data": {
    "type": "people_workspace_connector",
    "id": "a3f92c11-8d14-4e2b-b305-7c1e0f3a9d82",
    "attributes": {
      "direction": "input",
      "created_at": "2026-05-10T14:32:00.000Z",
      "updated_at": "2026-05-10T14:32:00.000Z",
      "deleted_at": null
    },
    "relationships": {
      "people": {
        "data": { "type": "people", "id": "d1e4b7f0-3c2a-4891-a5f6-0b9e8c7d6e5f" }
      },
      "workspace_connector": {
        "data": { "type": "workspace_connector", "id": "9b8c7a6d-5e4f-3210-b1a0-c9d8e7f6a5b4" }
      }
    }
  }
}
```

<sub>Source: `/Users/maximechampoux/platform/apps/api/src/database/entities/PeopleWorkspaceConnector.ts` · domain: ingestion · tier: Infrastructure</sub>
