GuidesEmployeeClaiming Orders

Claiming Orders

Staccato uses an exclusive claim system where each order is assigned to exactly one staff member.

Claim Flow

  1. Staff sees a pending order in the queue
  2. Taps “Claim” button
  3. OrderQueueService.claimOrder(orderId:):
    • Verifies the order is still pending
    • Verifies no one else has claimed it (assigned_to is null)
    • Sets status to in_progress
    • Sets assigned_to to the current user’s ID
    • Sets claimed_at to the current timestamp
  4. Order moves to the “In Progress” section

Validation Rules

CheckError
Order already claimed by another staff memberorderAlreadyClaimed
Order status is not pendinginvalidStatusTransition
User is not authenticatednotAuthenticated

Unclaiming

Staff can release an order back to the queue:

  1. Tap the unclaim action on a claimed order
  2. OrderQueueService.unclaimOrder(orderId:):
    • Verifies the order is assigned to the current user
    • Sets status back to pending
    • Sets assigned_to to null
    • Sets claimed_at to null
  3. Order returns to the “Pending” section

Only the staff member who claimed the order can unclaim it.

Database Updates

-- Claim: sets assigned_to and status
UPDATE orders SET
    status = 'in_progress',
    assigned_to = 'staff-user-id',
    claimed_at = NOW()
WHERE id = 'order-id';
 
-- Unclaim: resets to pending
UPDATE orders SET
    status = 'pending',
    assigned_to = NULL,
    claimed_at = NULL
WHERE id = 'order-id';