@withpotter/order — module reference
HTTP routes this module mounts, plus its internal use-cases, entities, and repositories. The exhaustive request/response contract is the engine’s OpenAPI document at /docs; the layered structure below follows the package internal architecture.
HTTP routes
Orders /orders
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /orders | Yes | List orders for the current tenant |
GET | /orders/:id | Yes | Get an order by id |
GET | /orders/number/:orderNumber | Yes | Get an order by its order number |
GET | /orders/stats | Yes | Order counts grouped by status |
Internals
Entities
Sequelize models owned by this module.
Order — table orders
| Field | Type |
|---|---|
id | string |
tenantId | string |
tenant | Tenant |
memberId | string | null |
member | Member |
items | OrderItem[] |
orderNumber | string |
status | OrderStatus |
subtotal | number |
discountTotal | number |
taxTotal | number |
shippingTotal | number |
total | number |
currency | string |
paymentStatus | PaymentStatus |
paymentMethod | string | null |
paymentReference | string | null |
fulfillmentStatus | FulfillmentStatus |
customerEmail | string |
customerName | string | null |
customerPhone | string | null |
shippingAddress | OrderAddress | null |
billingAddress | OrderAddress | null |
customerNote | string | null |
internalNote | string | null |
data | Record<string, unknown> |
createdAt | Date |
updatedAt | Date |
completedAt | Date | null |
cancelledAt | Date | null |
OrderItem — table order_items
| Field | Type |
|---|---|
id | string |
orderId | string |
contentId | string | null |
content | Content |
title | string |
sku | string | null |
variant | { id: string |
quantity | number |
unitPrice | number |
discount | number |
total | number |
fulfilledQuantity | number |
data | Record<string, unknown> |
createdAt | Date |
updatedAt | Date |
Repositories
Data-access classes wrapping the entities.
OrderRepository
findById · findByOrderNumber · findByPaymentReference · findWithFilters · findByMember · findFulfilledForReview · findByDiscountCode · countDiscountUsesByCustomer · countByCustomer · create · createWithItems · update · updateStatus · updatePaymentStatus · updateFulfillmentStatus · addOrderItem · updateOrderItemFulfillment · generateOrderNumber · countByStatus
Generated from the module’s source. Routes are relative to the engine root
(default http://localhost:3001). For full request/response schemas use the live
OpenAPI document.