bazzar/crates/stock_manager/docs/Actions.puml

81 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

2022-11-07 10:25:57 +01:00
@startuml
'https://plantuml.com/state-diagram
'scale 600 width
[*] --> CreateProduct
2022-11-07 16:28:51 +01:00
[*] --> UpdateProduct
[*] --> LoadDetailedProducts
2022-11-07 10:25:57 +01:00
2022-11-07 16:28:51 +01:00
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
2022-11-07 10:25:57 +01:00
2022-11-07 16:28:51 +01:00
HttpCreateProduct --> CallRpcCreateProduct : RPC
CallRpcCreateProduct --> InsertRecord
2022-11-07 10:25:57 +01:00
2022-11-07 16:28:51 +01:00
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
}
2022-11-07 10:25:57 +01:00
}
2022-11-07 16:28:51 +01:00
state LoadDetailedProducts {
2022-11-07 10:25:57 +01:00
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
2022-11-07 16:28:51 +01:00
state "Combine all data" as CombineData
state "Returns list via RPC" as RpcReturnsList
2022-11-07 10:25:57 +01:00
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