Add doc graphs

This commit is contained in:
eraden 2022-11-07 10:25:57 +01:00
parent be005629ca
commit 27dfa5444e
4 changed files with 204 additions and 2 deletions

View File

@ -0,0 +1,47 @@
@startuml
'https://plantuml.com/state-diagram
'scale 600 width
[*] --> CreateProduct
[*] --> LoadAllProducts
state CreateProduct {
HttpCreateProduct --> CallRpcCreateProduct : RPC
CallRpcCreateProduct --> InsertRecord
InsertRecord ---> RpcReturnDetailedProduct : RPC
InsertRecord ---> ProductCreatedEvent : MQTT
RpcReturnDetailedProduct --> [*]
ProductCreatedEvent --> [*]
}
state LoadAllProducts {
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
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

View File

@ -0,0 +1,52 @@
@startuml
'https://plantuml.com/class-diagram
class Product {
int id
String name
String category
}
class ProductVariant {
int id
int product_id
String name
String short_description
String long_description
int price
}
class Stock {
int id
int product_variant_id
int quantity
QuantityUnit quantity_unit
}
class Photo {
int id
String local_path
String file_name
String unique_name
}
class ProductPhoto {
int id
int product_variant_id
int photo_id
}
Product -- ProductVariant : owns >
ProductVariant -- Stock : owns >
Photo -- ProductPhoto : < owns
ProductVariant -- ProductPhoto : < owns
Stock -- QuantityUnit : contains
enum QuantityUnit {
g
dkg
kg
piece
}
@enduml

View File

@ -16,7 +16,7 @@ CREATE TABLE photos (
CREATE TABLE products ( CREATE TABLE products (
id integer NOT NULL PRIMARY KEY, id integer NOT NULL PRIMARY KEY,
name character varying NOT NULL, "name" character varying NOT NULL,
category character varying, category character varying,
deliver_days_flag integer DEFAULT 127 NOT NULL deliver_days_flag integer DEFAULT 127 NOT NULL
); );
@ -24,7 +24,7 @@ CREATE TABLE products (
CREATE TABLE product_variants ( CREATE TABLE product_variants (
id integer NOT NULL PRIMARY KEY, id integer NOT NULL PRIMARY KEY,
product_id integer REFERENCES products (id) NOT NULL, product_id integer REFERENCES products (id) NOT NULL,
name character varying NOT NULL, "name" character varying NOT NULL,
short_description character varying NOT NULL, short_description character varying NOT NULL,
long_description character varying NOT NULL, long_description character varying NOT NULL,
price integer NOT NULL, price integer NOT NULL,

103
docs/infrastructure.puml Normal file
View File

@ -0,0 +1,103 @@
@startuml
'https://plantuml.com/deployment-diagram
scale 1000
rectangle "API" {
node "bazzar"
queue rumqttd
component "Accounts Manager" {
node "account-manager"
database "PostgreSQL bazzar_accounts"
"account-manager" <--> "PostgreSQL bazzar_accounts"
"account-manager" --> rumqttd : emit event
usecase "create account"
usecase "me"
"account-manager" -- "create account"
"account-manager" -- "me"
}
component "Carts Manager" {
node "cart-manager"
database "PostgreSQL bazzar_carts"
"cart-manager" <--> "PostgreSQL bazzar_carts"
"cart-manager" <-- rumqttd : account created
}
component "Search Manager" {
node "search-manager"
database "sonic"
"search-manager" <--> "sonic"
"search-manager" <-- rumqttd : product created
"search-manager" <-- rumqttd : product deleted
}
component "Stock Manager" {
node "stock-manager"
database "PostgreSQL bazzar_stocks"
"stock-manager" <--> "PostgreSQL bazzar_stocks"
"stock-manager" --> rumqttd : emit event
}
component "E-Mail Sender" {
node "email-sender"
cloud "sendgrid"
"email-sender" --> "sendgrid"
"email-sender" <-- rumqttd : account created
"email-sender" <-- rumqttd : account deleted
}
actor " rumqttd"
"bazzar" -- "Accounts Manager" : rpc
"bazzar" -- "Carts Manager" : rpc
"bazzar" -- "E-Mail Manager" : rpc
"bazzar" --> " rumqttd" : emit event
}
rectangle "Dependencies" {
database "PostgreSQL bazzar_accounts "
database "PostgreSQL bazzar_carts "
database "sonic "
database "PostgreSQL bazzar_stocks " {
}
cloud "sendgrid "
queue "rumqtt d"
}
'actor actor
'actor/ "actor/"
'agent agent
'artifact artifact
'boundary boundary
'card card
'circle circle
'cloud cloud
'collections collections
'component component
'control control
'database database
'entity entity
'file file
'folder folder
'frame frame
'interface interface
'label label
'node node
'package package
'queue queue
'rectangle rectangle
'stack stack
'storage storage
'usecase usecase
'usecase/ "usecase/"
@enduml