---
# System prepended metadata

title: Buka Tutup Toko

---

# Buka Tutup Toko

```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")

}
ContainerDb(db_evm, "Database", "MySQL", "evm 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_R(admin_api, db_evm, "Reads from & Writes to", "TCP/IP")

```


### Brand Activation

```plantuml
skinparam responseMessageBelowArrow true

title Brand Activation - Existing Interaction Diagram

participant "client" as c
participant "evermos-admin-be" as eab
database "evm" as e

c -> eab : "activate/inactivate brand"
activate eab

eab -> e : check client token
activate e
return user data

eab -> e : "activate/inactivate brand"
activate e
return success/error
return success/error
```


## Database Design - Existing System

```plantuml
hide circle
'skinparam linetype ortho

skinparam class {
    ArrowColor #FF7878
    BackgroundColor #FFF89A
    BorderColor #694E4E
}

title EVM Database Schema

entity "[evm] brand" as b {
    *id: bigint(20)
    --
    brandParentId: bigint(20) <<FK>>
    warehouseShelfId: bigint(20) <<FK>>
    warehouseZoneId: bigint(20) <<FK>>
    partnershipId: bigint(20) <<FK>>
    code: varchar(20)
    slug: text
    name: varchar(100)
    type: enum
    logoUrl: text
    coverImageUrl: text
    commissionPercentage: float
    commissionPrice: float
    vendorCommissionPercentage: float
    vendorCommissionPrice: float
    courierFee: bigint(20)
    picName: varchar(255)
    picPhone: varchar(255)
    picAddress: varchar(255)
    stockLocation: int(11)
    ...
    createdTime: datetime
    updatedTime: datetime
    updatedBy: bigint(20)
    isActive: boolean
    isRemoved: boolean
    removedTime: datetime
    createdBy: bigint(20)
    removedBy: bigint(20)
    officeAddress: varchar(200)
    warehouseAddress: varchar(200)
    companyName: varchar(100)
    brandLevelId: int(11)
    brandType: enum
    brandResellerType: enum
}

entity "[evm] stock_location" as sl {
    *id: int(10)
    --
    label: varchar(255)
    districtId: int(11)
    districtName: varchar(255)
    subdistrictId: int(11)
    subdistrictName: varchar(255)
    urbanId: int(11)
    urbanName: varchar(255)
    shipperAreaId: int(11)
    shipperAgentId: int(11)
    shipperPickupTime: varchar(255)
    address: varchar(255)
    brandId: bigint(20)
    ...
    createdTime: datetime
    createdBy: bigint(20)
    updatedTime: datetime
    updatedBy: bigint(20)
    isActive: tinyint(1)
    isRemoved: tinyint(1)
    removedTime: datetime
    removedBy: bigint(20)
    
}


sl ||-left|{ b
b ||--|{ sl


```

## Architecture Diagram - Proposed Solution

```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 - 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
    is_removed: boolean
    created_at: datetime
    created_by: bigint(20)
    updated_at: datetime
    updated_by: bigint(20)
    removed_at: datetime
    removed_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 "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
```


### Get Stock Location List

```plantuml
skinparam responseMessageBelowArrow true

title Get Stock Location List - Proposed Interaction Diagram


participant "client" as c
participant "evermos-admin-be" as eab
database "evm" as e

c -> eab : get brand stock location list
activate eab

eab -> e : get brand stock location list
activate e

return stock location list
```


### Create Brand Stock Location Mapping

```plantuml
skinparam responseMessageBelowArrow true

title Create Brand Stock Location Mapping - Proposed 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 : create brand stock location mapping
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 : create brand stock location mapping
activate ei

ei -> inv : create brand stock location mapping
activate inv

return brand stock location data
return brand stock location data
return brand stock location data
```


### 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 "evermos-admin-be" as eab
participant "evm-inventory" as ei
database "evm" as e
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
```


### Set Default Stock Location

```plantuml
skinparam responseMessageBelowArrow true

title Set Default Stock Location - Proposed 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 : update wh is_default
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 wh is_default
activate ei

ei -> inv : update wh is_default
activate inv

return success/error
return success/error
return success/error
```
