feat(backend): KDS item claims across screens; zone screens only touch their own items (platform-v2 3.2c)
- order_items.claimed_by / claimed_at (Alembic 0015). POST/DELETE
/api/kds/orders/{id}/items/{item}/claim (kds.bump): someone else's claim is refused
(kds.item_claimed), letting go works for anyone with kds.bump; live kds_item_claimed.
In progress claims for whoever did it; done/served/pending/declined clear the claim.
- Fix: order-level status and decline from a zone screen changed every zone's items;
now only the screen's zone, and a zone screen sees the order status of its own items.
- Terminal: "I'm on it" / "Let go" on the selected card, the cook's name on claimed items.
- Tests: backend +6, terminal unit +1, terminal.mjs +6 with a second screen and cook.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""order_items.claimed_by / claimed_at: a cook claims a KDS item (plan step 3.2c)
|
||||
|
||||
Revision ID: 0015_item_claims
|
||||
Revises: 0014_sync_event_devices
|
||||
Create Date: 2026-11-14 21:00:00
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from core.timeutil import UTCDateTime
|
||||
|
||||
|
||||
revision = '0015_item_claims'
|
||||
down_revision = '0014_sync_event_devices'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table('order_items', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('claimed_by', sa.Integer(), nullable=True))
|
||||
batch_op.add_column(sa.Column('claimed_at', UTCDateTime(), nullable=True))
|
||||
batch_op.create_foreign_key('fk_order_items_claimed_by_users', 'users', ['claimed_by'], ['id'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table('order_items', schema=None) as batch_op:
|
||||
batch_op.drop_constraint('fk_order_items_claimed_by_users', type_='foreignkey')
|
||||
batch_op.drop_column('claimed_at')
|
||||
batch_op.drop_column('claimed_by')
|
||||
Reference in New Issue
Block a user