Order Item
Child entity within an Order capturing a purchased book identifier, positive quantity, and locked checkout-time unit price.
Domain Role & Boundary
Order Item is a child Entity owned by the OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs Aggregate Root in the OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing,
and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs bounded context. Persisted by Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle,
creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs, it records a single purchased title, its quantity, and its immutable checkout-time unit price. It explicitly does not own live book titles, descriptions, or promotional pricing (owned by CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and
consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs and referenced strictly by bookId).
Entity Profile
| Property | Value |
|---|---|
| Bounded Context / Domain | OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs |
| Owning Service | Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs |
| DDD Role | Child Entity (owned by OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs) |
| Identifier Strategy | UUIDv7 generated at persistence |
| Persistence Store | Ordering relational database (order_items) |
| Deletion Semantics | Cascade-deleted if parent is purged; hidden automatically when parent OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs is soft-deleted |
| Concurrency Control | Governed by parent OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs aggregate concurrency token |
| PII / Data Classification | Internal transactional record (non-PII) |
Attributes & Constraints
| Name | Type | Required | Description | Reference |
|---|---|---|---|---|
| id | UUID | required | Globally unique UUIDv7 identifier for the order line item. | — |
| orderId | UUID | required | Identifier of the parent Order aggregate. | orderProperty: id |
| bookId | UUID | required | Cross-context identifier of the Catalog Book purchased on this line. | bookProperty: id |
| quantity | integer | required | Positive number of copies purchased (must be greater than zero). | — |
| price | decimal | required | Non-negative per-unit price locked at checkout time. | — |
| Attribute | Business Rule / Constraint | Sensitivity / Notes |
|---|---|---|
orderId | Required foreign key to parent OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs. | Aggregate containment |
bookId | Required; unique per (bookId, orderId) so each book appears at most once per order. | Cross-context ID reference |
quantity | Required; must be strictly greater than zero (> 0). | Domain invariant |
price | Required; must be non-negative (>= 0), snapshotted from CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and
consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs at checkout. | Immutable after creation |
Domain Invariants & Lifecycle
- Positive quantity: Zero or negative item quantities are rejected at creation.
- Non-negative price snapshot: Unit prices must be zero or greater and remain immutable even when BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs prices later change in CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs.
- One line per book: An OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs cannot contain duplicate line items for the same
bookId. - Parent visibility coupling: Order items have no independent lifecycle; soft-deleting the parent OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs excludes all of its items from standard queries.
Order Item calculates its line subtotal (price * quantity), which the parent OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs sums to derive totalPrice.
Relationships & Associated Operations
| Category | Resource | Role / Interaction |
|---|---|---|
| Parent Aggregate | OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs | Owned child collection (orderItems) |
| Cross-Context References | BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs | Referenced strictly by bookId (no database foreign key) |
| Mutating Commands | Create orderCommandv1.0.0Create orderCreates an Order for the authenticated Buyer using the current basket and Catalog pricing.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Delete orderCommandv1.0.0Delete orderSoft-deletes an Order by its identifier without changing its business status.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Created atomically with the parent order; hidden on order soft-delete |
| Read Queries | Get orderQueryv1.0.0Get orderReturns Order details, including the recorded item quantities and prices.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, List ordersQueryv1.0.0List ordersReturns Orders with pagination and optional status and Buyer filters.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs | Included as part of parent order projections |