mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
[hw-3] loms service
This commit is contained in:
32
docs/homework-3/img/cart-cart-item-add.plantuml
Normal file
32
docs/homework-3/img/cart-cart-item-add.plantuml
Normal file
@@ -0,0 +1,32 @@
|
||||
@startuml
|
||||
|
||||
actor User as u
|
||||
collections Cart as c
|
||||
database CartStorage as cs
|
||||
collections ProductService as p
|
||||
collections Order as o
|
||||
|
||||
u -> c : POST /user/<user_id>/cart/<sku_id>\n\t- count
|
||||
activate c
|
||||
loop for each item in request
|
||||
c -> p : /get_product\n\t- sku\n\t- token
|
||||
activate p
|
||||
p -> c : \nResponse:\n\t- name\n\t- price
|
||||
deactivate p
|
||||
c -> c : validate product exists
|
||||
|
||||
c -> o : gRPC Loms.StocksInfo\n\t- sku
|
||||
activate o
|
||||
o -> c : Response:\n\t- count
|
||||
deactivate o
|
||||
c -> c : validate stocks
|
||||
alt stocks enough
|
||||
c -> cs : cart.AddItem()
|
||||
c -> u : 200 OK
|
||||
else
|
||||
c -> u : 412 Failed Precondition (insufficient stocks)
|
||||
end
|
||||
end
|
||||
deactivate c
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user