# Table Groups

Table grouping and floor plans

## GET /api/v1/table-groups

List table groups

List table groups with optional filtering and sorting

**Permissions:** 🔵 `table_groups.read`

Query parameters:
- `locationId` (number, optional) — Filter by location ID
- `search` (string, optional) — Search by name or description
- `sort` (string, optional) — Sort field (name, created_at)
- `order` ("asc" | "desc", optional) — Sort order
- `page` (number, optional) — Page number
- `limit` (number, optional) — Items per page

Response 200 — Default Response

```ts
{
  status: "success"
  data: {
    tableGroups: Array<{
        id: number
        name: string
        description?: string | null
        locationId: number
        tableIds: unknown[]
        createdAt: string // date-time
        updatedAt?: string | null // date-time
      }>
    pagination: {
      page: number
      limit: number
      total: number
      totalPages: number
    }
  }
  meta: {
    requestId: string
    timestamp: string // date-time
    executionTimeMs: number
  }
}
```

## POST /api/v1/table-groups

Create table group

Create a new table group

**Permissions:** 🟢 `table_groups.create`

Request body:

```ts
{
  locationId: number
  name: string
  description?: string
}
```

Response 201 — Default Response

```ts
{
  status: "success"
  data: {
    id: number
    name: string
    description?: string | null
    locationId: number
    tableIds: string[]
    createdAt: string // date-time
    updatedAt?: string | null // date-time
  }
  meta: {
    requestId: string
    timestamp: string // date-time
    executionTimeMs: number
  }
}
```

## GET /api/v1/table-groups/{id}

Get table group

Get a single table group by ID with table UUIDs

**Permissions:** 🔵 `table_groups.read`

Path parameters:
- `id` (string, required) — Table group ID

Response 200 — Default Response

```ts
{
  status: "success"
  data: {
    id: number
    name: string
    description?: string | null
    locationId: number
    tableIds: string[]
    createdAt: string // date-time
    updatedAt?: string | null // date-time
  }
  meta: {
    requestId: string
    timestamp: string // date-time
    executionTimeMs: number
  }
}
```

## PUT /api/v1/table-groups/{id}

Update table group

Update an existing table group

**Permissions:** 🟠 `table_groups.update`

Path parameters:
- `id` (string, required) — Table group ID

Request body:

```ts
{
  name?: string
  description?: string | null
}
```

Response 200 — Default Response

```ts
{
  status: "success"
  data: {
    id: number
    name: string
    description?: string | null
    locationId: number
    tableIds: string[]
    createdAt: string // date-time
    updatedAt?: string | null // date-time
  }
  meta: {
    requestId: string
    timestamp: string // date-time
    executionTimeMs: number
  }
}
```

## DELETE /api/v1/table-groups/{id}

Delete table group

Delete a table group

**Permissions:** 🔴 `table_groups.delete`

Path parameters:
- `id` (string, required) — Table group ID

Response 200 — Table group successfully deleted

```ts
{
  status?: "success"
  data?: {
    deleted?: boolean
  }
  meta?: {
    requestId: string
    timestamp: string // date-time
    executionTimeMs: number
  }
}
```
