bazzar/crates/stock_manager/docs/Actions.puml

81 lines
2.7 KiB
Plaintext

@startuml
'https://plantuml.com/state-diagram
'scale 600 width
[*] --> CreateProduct
[*] --> UpdateProduct
[*] --> LoadDetailedProducts
state Product {
state CreateProduct {
state "Received create Product " as HttpCreateProduct
state "Call RPC Create Product" as CallRpcCreateProduct
state "Insert record in database" as InsertRecord
state "Returns created product via RPC" as RpcReturnDetailedProduct
state "Emit product_created via MQTT" as ProductCreatedEvent
HttpCreateProduct --> CallRpcCreateProduct : RPC
CallRpcCreateProduct --> InsertRecord
InsertRecord ---> RpcReturnDetailedProduct : RPC
InsertRecord ---> ProductCreatedEvent : MQTT
RpcReturnDetailedProduct --> [*]
ProductCreatedEvent --> [*]
}
'state "Update product" as UpdateProduct
state UpdateProduct {
state "Received Update product via HTTP" as HttpUpdateProduct
state "Call RPC Update Product" as CallRpcUpdateProduct
state "Update Single Product" as UpdateSingleProduct
state "Returns updated product via RPC" as RpcReturnsUpdatedProduct
state "Returns failed to update product via RPC" as RpcReturnsFailedUpdateProduct
state "Emit product_updated via MQTT" as ProductUpdatedEvent
HttpUpdateProduct --> CallRpcUpdateProduct : RPC
CallRpcUpdateProduct --> UpdateSingleProduct
UpdateSingleProduct --> RpcReturnsUpdatedProduct
UpdateSingleProduct --> RpcReturnsFailedUpdateProduct
UpdateSingleProduct --> ProductUpdatedEvent
RpcReturnsUpdatedProduct --> [*] : Succeeded
RpcReturnsFailedUpdateProduct --> [*] : Failed
ProductUpdatedEvent --> [*] : Succeeded
}
}
state LoadDetailedProducts {
state "Received Load all HTTP Request" as HttpLoadAll
state "Call RPC Load All" as CallRpcLoadAll
state "Load add required data from DB" as LoadAllData
state "Load all products" as LoadProducts
state "Load all variants for all products" as LoadProductsVariants
state "Load all products photos" as LoadProductsPhotos
state "Combine all data" as CombineData
state "Returns list via RPC" as RpcReturnsList
HttpLoadAll --> CallRpcLoadAll : RPC
CallRpcLoadAll --> LoadAllData
LoadAllData --> LoadProducts : concurrently
LoadProducts --> CombineData
LoadAllData --> LoadProductsVariants : concurrently
LoadProductsVariants --> CombineData
LoadAllData --> LoadProductsPhotos : concurrently
LoadProductsPhotos --> CombineData
LoadAllData --> LoadProductsStock : concurrently
LoadProductsStock --> CombineData
CombineData --> RpcReturnsList : RPC
RpcReturnsList --> [*]
}
@enduml