refactor:centralize order status rules in shared package
Runner Test / test (push) Successful in 17s
Runner Test / test (pull_request) Successful in 18s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Abdulaziz Salim Said AL-Gharbi
2026-10-08 16:25:50 +04:00
co-authored by Claude Opus 5.5
parent 31b367e3a3
commit 12c4bc62c1
7 changed files with 38 additions and 24 deletions
@@ -1,6 +1,6 @@
import type { Address } from "@orderops/shared/address";
import { canEditShippingAddress, shippingAddressLockedMessage } from "@orderops/shared/order-status";
import type { DatabaseContext } from "../db/database";
import { canEditShippingAddress } from "./order-status";
import { appendAuditEvent, findOrderDetail, updateOrderAddress, updateOrderTimestamp } from "./order-repository";
export async function changeShippingAddress(
@@ -18,7 +18,7 @@ export async function changeShippingAddress(
}
if (!canEditShippingAddress(order.status)) {
return { statusCode: 400, message: "Shipping address cannot be changed for this order status." } as const;
return { statusCode: 400, message: shippingAddressLockedMessage } as const;
}
const updatedAt = new Date().toISOString();