Skip to content

fix(orders): allow pickup slot change after order is PRINTED#100

Merged
choden-dev merged 4 commits into
mainfrom
fix/allow-timeslot-change-when-printed
Jul 16, 2026
Merged

fix(orders): allow pickup slot change after order is PRINTED#100
choden-dev merged 4 commits into
mainfrom
fix/allow-timeslot-change-when-printed

Conversation

@choden-dev

Copy link
Copy Markdown
Owner

Problem

The order state machine did not allow the pickup slot to be changed once an order had been marked PRINTED. The POST /api/shop/:orderId/select-timeslot endpoint rejected any order whose status was not PAID or AWAITING_PICKUP, so a customer could no longer change their pickup slot after an admin printed the order.

Fix

app/api/shop/[orderId]/select-timeslot/route.ts:

  • Allow PRINTED orders through the status guard (in addition to PAID and AWAITING_PICKUP).
  • Treat PRINTED as a change rather than a first-time selection, so:
    • the status is preserved (PRINTEDPRINTED) — no invalid state transition, and the admin still sees the order as printed;
    • the previous timeslot's bookedCount is correctly decremented and the new slot's incremented.
  • Updated the route doc comment/error message.

No frontend change is required — OrderSteps.tsx already permits navigating to the PICKUP step to change the slot for PRINTED orders.

Testing

  • biome check passes on the changed file.
  • Pre-commit and pre-push hooks passed.

The select-timeslot endpoint previously rejected any order that was not PAID or AWAITING_PICKUP, so customers could not change their pickup slot once an admin marked the order PRINTED.

Allow PRINTED orders to change their timeslot. The status is preserved (PRINTED -> PRINTED) so no invalid state transition occurs, and the previous timeslot's bookedCount is correctly decremented.
Pin the Node runtime to v24 everywhere the version is declared:
- .nvmrc: lts/* -> 24
- package.json engines.node: >=20 -> >=24
- Dockerfile: node:22-slim -> node:24-slim (builder + runner)
- docker-entrypoint.sh / scripts/docker-build-step.sh: comment refs updated

CI (actions/setup-node) reads node-version-file: .nvmrc, so it picks up 24 automatically.
@choden-dev
choden-dev merged commit e581ca2 into main Jul 16, 2026
4 checks passed
@choden-dev
choden-dev deleted the fix/allow-timeslot-change-when-printed branch July 16, 2026 23:42
choden-dev added a commit that referenced this pull request Jul 17, 2026
…tend) (#101)

PR #100 allowed the select-timeslot endpoint to accept PRINTED orders, but
the customer-facing frontend never surfaced a way to trigger it:

- my-orders.tsx: 'Change Pickup' action was only shown for PAID and
  AWAITING_PICKUP orders, so a customer with a PRINTED order had no button.
- OrderContainer.tsx: navigating via ?pickupFor= only forced the PICKUP
  step for PAID/AWAITING_PICKUP; PRINTED orders fell through to
  statusToStep() which sends them to COMPLETE, hiding the timeslot picker.

Both now include PRINTED. The PICKUP step already renders TimeslotSelector
unconditionally, so the change UI works once the step is reached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants