feat(connect): the QR menu at the table: one code per table, orders straight onto the table
Plan phase 3S, step S.7. - tables.qr_token (migration 0021): a random token per active table; services/table_qr.py (tokens, rotate, the snapshot's `qr` with the tokens' sha256 only, the code's link from the cloud's apps_url); setting connect_menu.table_ordering (read-only by default). - /api/connect/qr (connect_menu.manage): the codes, ordering on/off, a new code per table or for all; table and QR changes push the menu at once (MENU_PATHS). - Pull: a QR order with a table id goes onto the table's open order or a new one (services/qr_orders.py): items at the cloud's prices, kitchen tickets, KDS, order_updated (the waiters' phones and the counter), a `qr_order` message to the order's waiters or the table's zone waiters; audit QR_ORDER (a repeated pull adds nothing); the cloud is told "accepted" (the guest's page: in the kitchen). No usable table or no open day → the counter gets it as before. Waiter app: the message's look. - Manager: Online → Table QR codes (/online/qr): ordering switch, the menu link, a QR card per table (print all), new code per table / for all. - Heartbeat: apps_url kept in the license state. - Tests: tests/test_qr_table.py (5); e2e qr_table.mjs (a real cloud and venue: table 5's code → two dishes on table 5's order, KDS, live event, the guest's page; a forged code refused; a new code kills the old one), in run-all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""tables: qr_token (the QR menu at the table, plan phase 3S, S.7)
|
||||
|
||||
Revision ID: 0021_table_qr_token
|
||||
Revises: 0020_online_reservations
|
||||
Create Date: 2026-11-16 23:30:00
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '0021_table_qr_token'
|
||||
down_revision = '0020_online_reservations'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table('tables', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('qr_token', sa.String(), nullable=True))
|
||||
batch_op.create_unique_constraint('uq_tables_qr_token', ['qr_token'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table('tables', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('uq_tables_qr_token', type_='unique')
|
||||
batch_op.drop_column('qr_token')
|
||||
Reference in New Issue
Block a user