Inventory Service
The inventory service consists of the context ProductItem.
It is responsible for managing the inventory - consisting of ProductItems of a ProductVariant. It is part of the order and return saga, where it reserves and releases the required ProductItems.
Domain Model
info
Imported entities from other bounded contexts are marked with a dashed border.
Technology Stack
- Language: TypeScript
- Framework: NestJS
- GraphQL Library: @nestjs/graphql with @nestjs/apollo (code first)
- Database: MongoDB
- Entity Management: Mongoose
Events
This section lists events that are defined or used by the inventory service.
Published Events
inventory/product/created
This event is published when a new product is created.
{
id: string,
internalName: string,
isPubliclyVisible: boolean,
defaultVariantId: string,
categoryIds: string[]
}
inventory/product-item/reservation-succeeded
This event is published when all ProductItems for the ProductVariants of an Orders OrderItems were reserved successfully.
{
order: Order;
}
inventory/product-item/reservation-failed
This event is published when at least one ProductItem for the ProductVariants of an Orders OrderItems could not be reserved.
{
order: Order,
failedProductVariantIds: string[]
}
Subscribed Events
- catalog/product-variant/created: Used to import
ProductVariantfrom theCatalogbounded context. - order/order/created: Used to reserve the
ProductItemsfor anOrder. - payment/payment/payment-enabled: Send Inventory to Fullfillment
- payment/payment/payment-failed: Releases Product Items related to the order
- shipment/shipment/status-updated: Updates the inventory status based on the shipment status
- shipment/shipment/created: Updates the inventory status based on the shipment status
- discount/order/validation-failed: Releases Product Items related to the order