# Buka Tutup Toko Phase 3
```plantuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
```
## Architecture Diagram - Existing
```plantuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
title Brand Activation - Mimin
Person(mimin, "Mimin")
System_Boundary(admin_web_system, "Evermos Administration Web Application") {
Container(browser, "Browser", "Software System", "All supported browser")
Container(admin_web_app, "Admin Dashboard", "Nuxt.js", "Provides management functionalities to admin via their web browser")
}
System_Boundary(api_endpoint, "API Endpoint") {
Container(admin_api, "evermos-admin-be API", "PHP", "Provides admin management functionalities via HTTPS / REST / JSON API")
Container(inventory_api, "evm-inventory API", "Golang", "Provides inventory management functionalities via HTTPS / REST / JSON API")
}
ContainerDb(db_evm, "Database", "MySQL", "evm schema")
ContainerDb(db_inv, "Database", "MySQL", "inv schema")
Rel_R(mimin, browser, "Register Brand", "Client Device")
Rel_R(browser, admin_web_app, "Access", "HTTPS")
Rel_R(admin_web_app, admin_api, "Makes API calls to", "HTTPS / REST / JSON")
Rel(admin_api, inventory_api, "Makes API calls to", "HTTPS / REST / JSON")
Rel_R(admin_api, db_evm, "Reads from & Writes to", "TCP/IP")
Rel_R(inventory_api, db_inv, "Reads from & Writes to", "TCP/IP")
```
## Database Design - Existing
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title INV Database Schema
entity "[inv] brand_stock_location_mapping" as bslm {
*id: char(36)
--
brand_id: varchar(36)
stock_location_id: varchar(36)
is_default: boolean
partnership_type: enum(dropship, consignment)
selling_status: boolean
selling_status_before_suspend: boolean
is_removed: boolean
created_at: datetime
created_by: bigint(20)
updated_at: datetime
updated_by: bigint(20)
removed_at: datetime
removed_by: bigint(20)
}
```
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title EVM_LOG Database Schema
entity "[evm_log] brand_stock_location_mapping_log" as bslml {
*id: int
--
brand_stock_location_mapping_id: varchar(36)
brand_id: varchar(36)
stock_location_id: varchar(36)
partnership_type: enum(dropship, consignment)
is_default: boolean
is_default_before: boolean
selling_status: boolean
selling_status_before: boolean
is_removed: boolean
created_at: datetime
created_by: bigint(20)
}
```
### Get Brand Stock Location List
```plantuml
skinparam responseMessageBelowArrow true
title Get Brand Stock Location List - Existing Interaction Diagram
participant "client" as c
participant "evermos-admin-be" as eab
participant "evm-inventory" as ei
database "evm" as e
database "inv" as inv
c -> eab : get brand stock location list
activate eab
eab -> e : check client token
activate e
alt if client unauthorized
e -> eab : error unauthorized
eab -> c : error unauthorized
end
return user data
eab -> ei : get brand stock location list
activate ei
ei -> inv : get brand stock location list
activate inv
return brand stock location list
return brand stock location list
return brand stock location list
```
### Update Brand Stock Location Selling Status
```plantuml
skinparam responseMessageBelowArrow true
title Update Brand Stock Location Selling Status - Existing Interaction Diagram
participant "client" as c
participant "evermos-admin-be" as eab
participant "evm-inventory" as ei
database "evm" as e
database "evm_log" as el
database "inv" as inv
c -> eab : update selling status
activate eab
eab -> e : check client token
activate e
alt if client unauthorized
e -> eab : error unauthorized
eab -> c : error unauthorized
end
return user data
eab -> ei : update selling status
activate ei
ei -> inv : update selling status
activate inv
return success/error
return success/error
return success/error
```
## Architecture Diagram - Proposed Solution
```plantuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
title Brand Activation - Mimin
Person(brand, "Brand Admin")
System_Boundary(brand_web_system, "Evermos Brand Administration Web Application") {
Container(browser, "Browser", "Software System", "All supported browser")
Container(brand_web_app, "Brand Dashboard", "Nuxt.js", "Provides management functionalities to brand admin via their web browser")
}
System_Boundary(api_endpoint, "API Endpoint") {
Container(brand_api, "evm-brand API", "PHP", "Provides brand management functionalities via HTTPS / REST / JSON API")
Container(inventory_api, "evm-inventory API", "Golang", "Provides inventory management functionalities via HTTPS / REST / JSON API")
}
ContainerDb(db_evm, "Database", "MySQL", "evm schema")
ContainerDb(db_inv, "Database", "MySQL", "inv schema")
Rel_R(brand, browser, "Register Brand", "Client Device")
Rel_R(browser, brand_web_app, "Access", "HTTPS")
Rel_R(brand_web_app, brand_api, "Makes API calls to", "HTTPS / REST / JSON")
Rel(brand_api, inventory_api, "Makes API calls to", "HTTPS / REST / JSON")
Rel_R(brand_api, db_evm, "Reads from & Writes to", "TCP/IP")
Rel_R(inventory_api, db_inv, "Reads from & Writes to", "TCP/IP")
```
## Database Design - Proposed Solution
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title INV Database Schema
entity "[inv] brand_stock_location_mapping" as bslm {
*id: char(36)
--
brand_id: varchar(36)
stock_location_id: varchar(36)
is_default: boolean
partnership_type: enum(dropship, consignment)
selling_status: boolean
selling_status_before_suspend: boolean
is_removed: boolean
created_at: datetime
created_by: bigint(20)
closed_at: datetime
updated_at: datetime
updated_by: bigint(20)
removed_at: datetime
removed_by: bigint(20)
}
```
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title EVM_LOG Database Schema
entity "[evm_log] brand_stock_location_mapping_log" as bslml {
*id: int
--
brand_stock_location_mapping_id: varchar(36)
brand_id: varchar(36)
stock_location_id: varchar(36)
partnership_type: enum(dropship, consignment)
is_default: boolean
is_default_before: boolean
selling_status: boolean
selling_status_before: boolean
source: varchar(50)
is_removed: boolean
created_at: datetime
created_by: bigint(20)
}
```
### Get Brand Stock Location List
```plantuml
skinparam responseMessageBelowArrow true
title Get Brand Stock Location List - Proposed Interaction Diagram
participant "client" as c
participant "evm-brand" as eb
participant "evm-inventory" as ei
database "evm" as e
database "inv" as inv
c -> eb : get brand stock location list
activate eb
eb -> e : check client token
activate e
alt if client unauthorized
e -> eb : error unauthorized
eb -> c : error unauthorized
end
return user data
eb -> ei : get brand stock location list
activate ei
ei -> inv : get brand stock location list
activate inv
return brand stock location list
return brand stock location list
return brand stock location list
```
### Update Brand Stock Location Selling Status
```plantuml
skinparam responseMessageBelowArrow true
title Update Brand Stock Location Selling Status - Proposed Interaction Diagram
participant "client" as c
participant "evm-brand" as eb
participant "evm-inventory" as ei
database "evm" as e
database "inv" as inv
c -> eb : update selling status
activate eb
eb -> e : check client token
activate e
alt if client unauthorized
e -> eb : error unauthorized
eb -> c : error unauthorized
end
return user data
eb -> ei : update selling status
activate ei
ei -> inv : update selling status
activate inv
return success/error
return success/error
return success/error
```
### Get Brand Data
```plantuml
skinparam responseMessageBelowArrow true
title Get Brand Data - Interaction Diagram
participant "client" as c
participant "evm-brand" as eb
participant "evm-product" as ep
database "evm" as e
c -> eb : get brand data
activate eb
eb -> ep : get brand data
activate ep
ep -> e : get brand data
activate e
return brand data
return brand data
return brand data
```