packages/shared/src/order-status.ts: each action now has its own list of allowed statuses.
apps/api/src/orders/order-status.ts: removed. rule now imported from @orderops/shared/order-status.
apps/api/src/orders/order-repository.ts: findOrderItemRecord now returns the order status as OrderStatus, the same way findOrderDetail does, so update-order-item.ts no longer needs the as never cast.
apps/web/src/orders/order-page.tsx: uses the shared rules
How to test
bun run test
bun run build:web
bun run check
Manual checks:
Not run. Changing the quantity on ORD-1002 (processing) should show "Order items cannot be changed for this order status." and send no request.
Not run. Changing the address on, or cancelling, ORD-1003 (shipped) should show the same API error messages as before.
Screenshots or recordings
N/A. No visible UI change.
Risks / follow-ups
Low risk: the allowed-status lists and messages match the old checks exactly, and the owner's tests cover each action on processing and shipped orders.
packages/shared now contains runtime code (the rule functions and messages) as well as types. Both the API and web builds pick it up.
Follow-up: the 3 existing TS2322 errors in the assignment test files will fail bun run check once it becomes a required CI gate.
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
This refactor puts the order status rules in one place and doesn't change behavior.
## Ticket / Assignment
- Ticket: #22
## What changed
- `packages/shared/src/order-status.ts`: each action now has its own list of allowed statuses.
- `apps/api/src/orders/order-status.ts`: removed. rule now imported from `@orderops/shared/order-status`.
- `apps/api/src/orders/order-repository.ts`: `findOrderItemRecord` now returns the order status as `OrderStatus`, the same way `findOrderDetail` does, so `update-order-item.ts` no longer needs the `as never` cast.
- `apps/web/src/orders/order-page.tsx`: uses the shared rules
## How to test
```bash
bun run test
bun run build:web
bun run check
```
Manual checks:
- Not run. Changing the quantity on ORD-1002 (processing) should show "Order items cannot be changed for this order status." and send no request.
- Not run. Changing the address on, or cancelling, ORD-1003 (shipped) should show the same API error messages as before.
## Screenshots or recordings
N/A. No visible UI change.
## Risks / follow-ups
- Low risk: the allowed-status lists and messages match the old checks exactly, and the owner's tests cover each action on processing and shipped orders.
- packages/shared now contains runtime code (the rule functions and messages) as well as types. Both the API and web builds pick it up.
- Follow-up: the 3 existing TS2322 errors in the assignment test files will fail bun run check once it becomes a required CI gate.
## 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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
This refactor puts the order status rules in one place and doesn't change behavior.
Ticket / Assignment
What changed
packages/shared/src/order-status.ts: each action now has its own list of allowed statuses.apps/api/src/orders/order-status.ts: removed. rule now imported from@orderops/shared/order-status.apps/api/src/orders/order-repository.ts:findOrderItemRecordnow returns the order status asOrderStatus, the same wayfindOrderDetaildoes, soupdate-order-item.tsno longer needs theas nevercast.apps/web/src/orders/order-page.tsx: uses the shared rulesHow to test
Manual checks:
Screenshots or recordings
N/A. No visible UI change.
Risks / follow-ups
PR checklist
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.