Table Lifecycle
Tables progress through several statuses:- available: Ready for customers
- occupied: Currently serving customers (has active session)
- reserved: Reserved for future customers
- maintenance: Temporarily unavailable
Status Transitions
Valid status transitions:QR Code Workflow
Each table has a unique QR code generated from the branch slug and table number:- QR Generation: When creating a table, a QR code is automatically generated using
{branchSlug}-{tableNumber} - Customer Scan: Customers scan the QR code to access the menu and start a session
- Session Creation: The customer app uses the QR code to identify the table and branch
- Authentication: A customer JWT token is issued for session authentication
Core Endpoints
Table Management
GET /api/tables- List all tables for a branchPOST /api/tables- Create a new tablePATCH /api/tables/:id- Update table capacity or spacePATCH /api/tables/:id/status- Change table statusPATCH /api/tables/:id/position- Update table position (for floor plan)DELETE /api/tables/:id- Delete a table
Table Sessions
POST /api/tables/sessions- Start a new table sessionGET /api/tables/sessions- List sessions with optional status filterGET /api/tables/sessions/pending- List pending sessions awaiting approvalGET /api/tables/sessions/:id- Get session detailsPATCH /api/tables/sessions/:id/approve- Approve a pending sessionPATCH /api/tables/sessions/:id/reject- Reject a pending sessionPATCH /api/tables/sessions/:id/end- End an active session
Waiter Assignments
GET /api/tables/my-assignments- Get tables assigned to current userGET /api/tables/:id/assignments- List waiters assigned to a tablePOST /api/tables/:id/assignments- Assign a waiter to a tableDELETE /api/tables/:id/assignments/:userId- Remove waiter assignment
History & Analytics
GET /api/tables/:id/history- View table history with sessions and orders
Authentication
All table management endpoints require:- Bearer token authentication (staff JWT)
- Organization and branch context via
tenantMiddleware - Appropriate permissions (e.g.,
tables:read,tables:create,tables:update)
Real-time Updates
Table status changes and session events are broadcast via WebSocket:table:status- Table status changedsession:started- New session startedsession:pending- Session awaiting approvalsession:approved- Session approvedsession:rejected- Session rejectedsession:ended- Session ended