Fix: Restrict order quantity edits to pending orders #20

Open
dsel wants to merge 1 commits from fix/restrict-quantity-updates-to-pending-orders into master
Collaborator

Summary

Quantity edits are now allowed only for pending orders. Non-pending orders show read only quantities in the UI.

Ticket / Assignment

What changed

  • Added a shared canEditOrderItems rule.
  • Backend now rejects quantity edits for processing and shipped orders.
  • Frontend shows read-only quantities for non-pending orders.

How to test

bun.exe test apps/api/src/orders/order-quantity-assignment-3.test.ts
bun.exe run test
bun.exe run build:web

Manual checks:

  1. Log in as an employee.
  2. Open a pending order and confirm quantity can be edited and saved.
  3. Open a processing order and confirm quantity is read-only.
  4. Open a shipped order and confirm quantity is read-only.
  5. Confirm non-pending orders show the pending-only message and no Save button.

Screenshots or recordings

image.png

image.png

image.png

Risks / follow-ups

  • Full typecheck is blocked by existing test cookie typing errors.

PR checklist

  • change is scoped to one ticket or one small reviewable concern
  • acceptance criteria were checked
  • code follows CONTRIBUTING.md
  • no unrelated refactor is mixed in
  • debug code and temporary logs are removed
  • relevant automated checks were run locally
  • changed behavior was manually tested when needed
  • known risks or follow-ups are called out
## Summary Quantity edits are now allowed only for pending orders. Non-pending orders show read only quantities in the UI. ## Ticket / Assignment - Ticket: [Assignment 3](https://git.letphil.com/derrick/ai-wave-02/issues/15) ## What changed - Added a shared `canEditOrderItems` rule. - Backend now rejects quantity edits for processing and shipped orders. - Frontend shows read-only quantities for non-pending orders. ## How to test ```bash bun.exe test apps/api/src/orders/order-quantity-assignment-3.test.ts bun.exe run test bun.exe run build:web ``` Manual checks: 1. Log in as an employee. 2. Open a pending order and confirm quantity can be edited and saved. 3. Open a processing order and confirm quantity is read-only. 4. Open a shipped order and confirm quantity is read-only. 5. Confirm non-pending orders show the pending-only message and no Save button. ## Screenshots or recordings ![image.png](/attachments/a60d00fc-8fd9-49d5-8b3d-3e1bf10d11ce) ![image.png](/attachments/0201a909-c57d-458b-9185-7f4f3477687b) ![image.png](/attachments/7e3860e9-723f-4b9a-ae2d-e07ac1845aea) ## Risks / follow-ups - Full typecheck is blocked by existing test cookie typing errors. ## PR checklist - [x] change is scoped to one ticket or one small reviewable concern - [x] acceptance criteria were checked - [x] code follows `CONTRIBUTING.md` - [x] no unrelated refactor is mixed in - [x] debug code and temporary logs are removed - [x] relevant automated checks were run locally - [x] changed behavior was manually tested when needed - [x] known risks or follow-ups are called out
dsel added 1 commit 2026-10-02 06:06:54 +00:00
Restrict order quantity edits to pending orders
Runner Test / test (push) Successful in 17s
Runner Test / test (pull_request) Successful in 17s
8297a2dd9d
All checks were successful
Runner Test / test (push) Successful in 17s
Runner Test / test (pull_request) Successful in 17s
This pull request has changes conflicting with the target branch.
  • apps/api/src/orders/order-status.ts
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/restrict-quantity-updates-to-pending-orders:fix/restrict-quantity-updates-to-pending-orders
git checkout fix/restrict-quantity-updates-to-pending-orders
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: derrick/ai-wave-02#20