@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

MethodPathAuthDescription
GET/ordersYesList orders for the current tenant
GET/orders/:idYesGet an order by id
GET/orders/number/:orderNumberYesGet an order by its order number
GET/orders/statsYesOrder counts grouped by status

Internals

Entities

Sequelize models owned by this module.

Order — table orders

FieldType
idstring
tenantIdstring
tenantTenant
memberIdstring | null
memberMember
itemsOrderItem[]
orderNumberstring
statusOrderStatus
subtotalnumber
discountTotalnumber
taxTotalnumber
shippingTotalnumber
totalnumber
currencystring
paymentStatusPaymentStatus
paymentMethodstring | null
paymentReferencestring | null
fulfillmentStatusFulfillmentStatus
customerEmailstring
customerNamestring | null
customerPhonestring | null
shippingAddressOrderAddress | null
billingAddressOrderAddress | null
customerNotestring | null
internalNotestring | null
dataRecord<string, unknown>
createdAtDate
updatedAtDate
completedAtDate | null
cancelledAtDate | null

OrderItem — table order_items

FieldType
idstring
orderIdstring
contentIdstring | null
contentContent
titlestring
skustring | null
variant{ id: string
quantitynumber
unitPricenumber
discountnumber
totalnumber
fulfilledQuantitynumber
dataRecord<string, unknown>
createdAtDate
updatedAtDate

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.