Skip to content

Order

The Order entity represents a confirmed customer order with billing information, delivery tracking, and line items. Orders are created after quotes are accepted or directly for catalog products, and they track the entire fulfillment lifecycle from placement through delivery.


PropertyTypeDescriptionValidation
idUUIDUnique order identifierGenerated automatically
externalIdstringExternal system/ERP order IDOptional, for bidirectional sync
PropertyTypeDescriptionValidation
billedAmountnumberTotal billed amountRequired on create, double precision
currencyIdUUIDCurrency for billingOptional, references Currency entity
PropertyTypeDescriptionValidation
orderDateDateWhen order was placedOptional
expectedDeliveryDateDateEstimated delivery dateOptional
actualDeliveryDateDateActual delivery dateOptional, set when delivered
trackingIdstringShipping tracking numberOptional
shippingAddressIdUUIDDelivery addressOptional, references Address entity
PropertyTypeDescriptionValidation
statusIdUUIDCurrent order statusOptional, references Status entity
createdByIdUUIDUser who created orderOptional, references User entity
createdAtDateCreation timestampAuto-generated
updatedAtDateLast update timestampAuto-generated, indexed
deletedAtDateSoft delete timestampOptional, indexed

RelationshipTypeTarget EntityDescriptionRequired
itemsOne-to-ManyOrderItemLine items in the orderYes
companyMany-to-OneCompanyCustomer companyNo
projectMany-to-OneProjectAssociated projectNo
statusMany-to-OneStatusOrder status (e.g., pending, shipped)No
currencyMany-to-OneCurrencyBilling currencyNo
shippingAddressMany-to-OneAddressDelivery destinationNo
createdByMany-to-OneUserUser who created orderNo
filesOne-to-ManyFileAttached documents (invoices, receipts)No
commentsOne-to-ManyCommentOrder comments and notesNo
customFieldsOne-to-ManyCustomFieldValueCustom field valuesNo

Orders support customizable status workflows through the Status entity.

Common Status Workflow:

  • Pending → Order created, awaiting processing
  • Processing → Order being prepared/manufactured
  • Shipped → Order dispatched to customer
  • Delivered → Order received by customer
  • Cancelled → Order cancelled
  • On Hold → Order temporarily paused

Status Configuration:

  • Statuses are configurable per organization
  • Each status has internal and external labels
  • Status transitions can be tracked via updatedAt field

The Order entity supports bidirectional synchronization with ERP systems:

FieldPurposeUsage
externalIdERP order referenceStore ERP order ID for sync
billedAmountTotal billing amountSync with ERP invoicing
trackingIdShipping trackingUpdate from shipping system
orderDateOrder placement dateSync with ERP order date
expectedDeliveryDateDelivery estimateCalculate from ERP production schedule
actualDeliveryDateConfirmed deliveryUpdate from shipping/delivery confirmation

1. Create Order from ERP:

POST /orders
{
"externalId": "ERP-12345",
"companyId": "uuid-company",
"projectId": "uuid-project",
"billedAmount": 5000.00,
"orderDate": "2024-01-15T10:00:00Z"
}

2. Query Order by ERP ID:

Terminal window
GET /orders?externalId=ERP-12345

3. Update Delivery Status:

PATCH /orders/:id
{
"trackingId": "TRACK-987654",
"actualDeliveryDate": "2024-02-14T14:30:00Z"
}

EndpointMethodDescription
/ordersPOSTCreate new order
/orders/:idGETGet order with items
/orders/:idPATCHUpdate order
/orders/:idDELETEDelete order (soft delete)
/ordersGETList orders with filtering

// 1. Create Order
POST /orders
{
"companyId": "company-uuid",
"projectId": "project-uuid",
"billedAmount": 3500.00,
"currencyId": "currency-uuid",
"orderDate": "2024-01-15T10:00:00Z",
"expectedDeliveryDate": "2024-02-15T10:00:00Z",
"shippingAddressId": "address-uuid"
}
// 2. Add Order Items (see OrderItem entity)
// 3. Track delivery progress via status updates
// Update tracking information
PATCH /orders/order-uuid
{
"trackingId": "TRACK-123456",
"statusId": "shipped-status-uuid"
}
// Later: confirm delivery
PATCH /orders/order-uuid
{
"actualDeliveryDate": "2024-02-14T09:30:00Z",
"statusId": "delivered-status-uuid"
}

The Order entity supports advanced filtering and pagination:

Filter Parameters:

  • companyId: Filter by customer
  • projectId: Filter by project
  • statusId: Filter by status (comma-separated for multiple)
  • externalId: Filter by ERP ID
  • orderDateStart, orderDateEnd: Date range filters
  • expectedDeliveryDateStart, expectedDeliveryDateEnd: Delivery estimate filters
  • actualDeliveryDateStart, actualDeliveryDateEnd: Actual delivery filters
  • createdById: Filter by creator

Pagination:

  • page: Page number (default: 1)
  • limit: Items per page (default: 10)
  • sort: Sort field (e.g., orderDate, updatedAt)
  • order: Sort direction (ASC, DESC)

Example Query:

Terminal window
GET /orders?companyId=uuid&statusId=uuid-1,uuid-2&orderDateStart=2024-01-01&page=1&limit=50&sort=orderDate&order=DESC