Giao diện
Đơn hàng
Trang sinh tự động
Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.
Làm gì
Đơn hàng của cả hai mô hình mua, với mã đơn riêng và lịch sử trạng thái. Mua định kỳ chia theo kỳ, mỗi kỳ có cửa sổ giao và quyền bỏ qua trong giới hạn gói. Huỷ đơn chưa thanh toán thì miễn phí; đơn đã cọc đi theo đường hoàn tiền.
Quy mô
| Domain API | order, order-return, recurring-skip |
| Query / Mutation | 16 / 7 |
| Nguồn dữ liệu | order_fulfillment |
| Bảng | 21 |
| Luật phân quyền | 9 |
| Đường dẫn Web Admin | 6 |
Thao tác (mutation)
| Mutation | Domain | Mô tả |
|---|---|---|
cancelCycleSkip | recurring-skip | U28-P2-04 (DEC-U28-02): a confirmed skip cannot be undone, every call is conflict skip_irreversible (nothing written; the ACTIVE skips already recorded stay). Kept for compatibility. Requires order.request_skip (SKP-01, OWN). |
dropOrderPoints | order | U-30b "Tiếp tục không dùng điểm" (BR-DC-06): the caller's own Group Buy |
requestCycleSkip | recurring-skip | Skips one cycle of an own LOCKED Recurring order while the cycle has no shipment (cycle_in_shipment after; PAF DEC-PAF-05: no time lock, cutoff_passed no longer returned). Past the package n: conflict limit_reached, nothing written (owner 22/10, D13). U28-P2-04 (DEC-U28-03): a cycle empty after the MOQ is conflict cycle_empty, no skip counted. Requires order.request_skip (SKP-01, OWN). |
requestOrderCancellation | order | Cancels an own order before the cutoff: a PLACED order requests its refund; an unpaid one is cancelled free (O3; conflict reason payment_pending while a deposit attempt is in flight). Requires order.request_cancel (U-03, OWN). |
settleFailedDeliveryCycle | order | #479 A. Operations settle a Mua định kỳ cycle whose delivery failed for good (DELIVERY_FAILED) and is not paid in full: |
submitGroupOrder | order | Creates a DEPOSIT_PENDING order from an open own quote. Requires order.create. |
submitRecurringOrder | order | Commits the quoted basket (its package and window) into one DEPOSIT_PENDING |
Phép đọc (query)
| Query | Domain | Mô tả |
|---|---|---|
adminOrder | order | U19-P2-11. One order for the Admin detail. Requires order.read (OPS-02 |
adminOrderHistory | order | Order history of every change (order status, payment, delivery, Pi-Point, |
adminOrders | order | Staff order list/search, newest first. Requires order.read (OPS-02 ALL; M-02 TEAM: orders attributed to a Sale |
adminOrderTabCounts | order | U19-P2-10. Tab counts (Tat ca / Mua chung / Mua dinh ky) of adminOrders under the same search and filters, |
cycleSchedule | recurring-skip | Schedule, immutable n/cutoff snapshot and skip state of an own Recurring order. Requires order.read (U-01, OWN). |
groupQuote | order | Server quote for one Group Buy product. Requires order.create (U-02, own). |
myOrderCounts | order | Chip counts of the caller's own orders, same filters as myOrders. Requires order.read (U-01, own). |
myOrders | order | The caller's own orders, newest first. Requires order.read (U-01, own). |
order | order | One own order; another account's order is not_found. Requires order.read. |
orderCancellationEligibility | order | Server-computed cancellation eligibility of an own order. Requires order.read (U-01, OWN). |
orderEvents | order | Order history, oldest first. Requires order.read (U-01 own, M-02 TEAM). |
orderReturnCase | order-return | The RETURN case of one Order, or null. Requires order.read (GAP-1320: no role yet). |
orderReturnCases | order-return | RETURN cases, newest first, optionally of one shipment. Requires order.read. |
paymentStatus | order | Canonical status of one payment attempt. Requires payment.read (U-04 own, F-01 Finance). |
publicRecurringQuote | order | G2S S12: quote of a guest's device basket for a published OPEN Recurring campaign (closed: conflict campaign_closed; unknown, unpublished or Group Buy: not_found; an empty cycle: validation_failed cycle_empty). No sign-in needed (deal.read_public, PUB-01; a Sale reads not_found); x-pi-app is still required. |
recurringQuote | order | Server quote of the caller's own Recurring basket. G2S (DEC-FS27-MD-EMPTY-CYCLE; the same rule as U28-P2-04 DEC-U28-03): a cycle where every product is 0 is validation_failed reason cycle_empty with details.cycleNo (the first one); every cycle must reach the minimum. Requires order.create (U-02, own). |
Dữ liệu
- Domain
order_fulfillment— 21 bảng, 4 nhóm con: order (14) · shipment (3) · fulfillment (2) · stock (2)
Bảng được tham chiếu nhiều nhất trong module:
| Bảng | Cột | Được trỏ tới | RLS |
|---|---|---|---|
orders | 65 | 41 | ✓ |
order_cycles | 14 | 9 | ✓ |
shipments | 46 | 8 | ✓ |
order_periods | 15 | 4 | ✓ |
stock_shortage_cases | 14 | 4 | ✓ |
order_close_outcomes | 26 | 2 | ✓ |
order_lines | 18 | 2 | ✓ |
order_quotes | 32 | 2 | ✓ |
shipment_order_links | 9 | 2 | ✓ |
fulfillment_events | 20 | 1 | ✓ |
Quyền
| Mã | Quyền | Ứng dụng | Vai trò | Phạm vi | Trạng thái |
|---|---|---|---|---|---|
M-02 | order.read | WEB_ADMIN | sale_manager | TEAM | DEFINED |
O-02 | order.manage | WEB_ADMIN | operations admin | ALL | PROPOSED |
OPS-02 | order.read | WEB_ADMIN | operations admin | ALL | PROPOSED |
ORD-01 | order.cancel | WEB_ADMIN | operations admin | ALL | DEFINED |
S-02 | order.read | APP_SALE | sale | ASSIGNED | DEFINED |
SKP-01 | order.request_skip | APP_USER | user | OWN | PROPOSED |
U-01 | order.read | APP_USER | user | OWN | DEFINED |
U-02 | order.create | APP_USER | user | OWN | PROPOSED |
U-03 | order.request_cancel | APP_USER | user | OWN | PROPOSED |
Danh sách đầy đủ và cách đọc các cờ: Ma trận quyền.
Giao diện Web Admin
| Đường dẫn | Hằng số |
|---|---|
/orders | ORDERS |
/orders/:id | ORDER_DETAIL |
/orders/:id/payment | ORDER_PAYMENT |
/orders/exceptions | ORDER_EXCEPTIONS |
/orders/exceptions/:id | ORDER_EXCEPTION_DETAIL |
/orders/exceptions/new | ORDER_EXCEPTION_NEW |
File nguồn
Backend:
code/apps/api/supabase/functions/graphql/domains/order/code/apps/api/supabase/functions/graphql/domains/order-return/code/apps/api/supabase/functions/graphql/domains/recurring-skip/
Dữ liệu: bảng thuộc domain order_fulfillment — xem Cơ sở dữ liệu.