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

# WorkspaceGroupWorkspace

> WorkspaceGroupWorkspace is the join-table entity that links a WorkspaceGroup to an individual Workspace, forming the 'which workspaces belong to this group' edg

WorkspaceGroupWorkspace is the join-table entity that links a WorkspaceGroup to an individual Workspace, forming the "which workspaces belong to this group" edge. It is written exclusively by the workspace-group management pipeline (group creation / workspace enrollment flows); users have no resource PATCH endpoint against this table. The row carries a soft-delete column so that removing and re-adding the same (group, workspace) pair is legal — the partial unique index enforces at most one live join per pair while allowing re-creation after soft-deletion. An optional created\_by foreign key records which People actor enrolled the workspace.

| Naming                          | Value                             |
| ------------------------------- | --------------------------------- |
| Object                          | WorkspaceGroupWorkspace           |
| Resource type (JSON:API `type`) | `workspace_group_workspace`       |
| Collection / records root       | — <sub>(not a records root)</sub> |
| REST base                       | `/v1/workspace-group-workspaces`  |
| Entity class                    | `WorkspaceGroupWorkspace`         |

<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/workspace-group-workspaces`         | 🟡 Planned |
| Retrieve  | `GET /v1/workspace-group-workspaces/{id}`    | 🟡 Planned |
| Create    | `POST /v1/workspace-group-workspaces`        | 🟡 Planned |
| Update    | `PATCH /v1/workspace-group-workspaces/{id}`  | 🟡 Planned |
| Delete    | `DELETE /v1/workspace-group-workspaces/{id}` | 🟡 Planned |

## Data model

### Attributes

| Field       | Type                    | Required | Constraints                                                                                                                                             | Allowed values | Description                                                                                                                                                       |
| ----------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| created\_at | 🔒 system — timestamptz | ✅ Yes    | Set on INSERT via onCreate hook; never NULL                                                                                                             | —              | Timestamp when the workspace was enrolled into the group. Set automatically on creation.                                                                          |
| updated\_at | 🔒 system — timestamptz | ⚪ No     | Set on INSERT and on every UPDATE via onUpdate hook; nullable in DB                                                                                     | —              | Timestamp of the last modification to this join row. Updated automatically.                                                                                       |
| deleted\_at | 🔒 system — timestamptz | ⚪ No     | NULL means live; non-NULL means soft-deleted. The partial unique index on (workspace\_group\_pk, workspace\_pk) applies only WHERE deleted\_at IS NULL. | —              | Soft-delete timestamp. When set, the workspace is considered removed from the group. The row is retained so that re-enrollment does not collide with the old row. |

### Relationships

| Name             | Type               | Required | Description                                                                                                                                                                                                    |
| ---------------- | ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| workspace\_group | to-one (ManyToOne) | ✅ Yes    | The WorkspaceGroup that this row belongs to. FK workspace\_group\_pk references core\_api.workspace\_groups(pk); RESTRICT on delete (no cascade).                                                              |
| workspace        | to-one (ManyToOne) | ✅ Yes    | The Workspace being enrolled in the group. FK workspace\_pk references core\_api.workspaces(pk); RESTRICT on delete (no cascade).                                                                              |
| created\_by      | to-one (ManyToOne) | ⚪ No     | The People actor who enrolled this workspace into the group. FK created\_by\_pk references core\_api.peoples(pk); SET NULL on delete. Nullable — rows created by system flows or migrations may have no actor. |

### System-computed

* pk — auto-increment serial primary key, internal only; never exposed in the public API
* created\_at — set to new Date() by the MikroORM onCreate hook on INSERT
* updated\_at — set to new Date() by the MikroORM onUpdate hook on every UPDATE
* deleted\_at — set by the workspace-group management service when a workspace is removed from a group; never set by user direct PATCH
* Partial unique index workspace\_group\_workspaces\_group\_workspace\_active\_unique enforces at most one live (workspace\_group\_pk, workspace\_pk) pair WHERE deleted\_at IS NULL — allows remove-then-re-add without 500 collisions
* The unconditional unique constraint workspace\_group\_workspaces\_workspace\_group\_pk\_wor\_3c190\_unique was dropped by Migration20260529030000 and replaced with the partial unique index

## Example

```json theme={null}
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "workspace_group_workspace",
    "attributes": {
      "created_at": "2026-05-28T09:15:00.000Z",
      "updated_at": "2026-05-28T09:15:00.000Z",
      "deleted_at": null
    },
    "relationships": {
      "workspace_group": {
        "data": { "type": "workspace_group", "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479" }
      },
      "workspace": {
        "data": { "type": "workspace", "id": "c9bf9e57-1685-4c89-bafb-ff5af830be8a" }
      },
      "created_by": {
        "data": { "type": "people", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
      }
    }
  }
}
```

<sub>Source: `/Users/maximechampoux/platform/apps/api/src/database/entities/WorkspaceGroupWorkspace.ts` · domain: workspace · tier: Platform</sub>
