# Flag Already Printed
## Architecture Diagram
```plantuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
title Flag Already Printed - Architecture Diagram
Person(brand_admin, "Brand Admin")
System_Boundary(brand_web_system, "Brand Administration Web Application") {
Container(brand_web, "Browser", "Software System", "All supported browser")
Container(brand_app, "Brand Administration Web Application", "Nuxt.js", "Provides brand management functionalities to brand admin via their web browser")
}
System_Boundary(brand_mobile_system, "Brand Administration Mobile Application") {
Container(brand_mobile, "Mobile Device", "Mobile System", "All supported mobile devices")
Container(partner_app, "Brand Administration Mobile Application", "Flutter", "Provides brand management functionalities to brand admin via their web mobile app")
}
System_Boundary(api_endpoint, "API Endpoint") {
Container(evermos_brand_be, "evermos-brand-be API", "PHP", "Provides brand management functionalities via HTTPS / REST / JSON API")
}
ContainerDb(db_evm, "Database", "MySQL", "evm schema")
ContainerDb(db_itr, "Database", "MySQL", "itr schema")
Lay_L(brand_web_system, brand_mobile_system)
Rel(brand_admin, brand_web, "View dashboard", "Client Device")
Rel(brand_web, brand_app, "Access", "HTTPS")
Rel(brand_app, evermos_brand_be, "Makes API calls to", "HTTPS / REST / JSON")
Rel(brand_admin, brand_mobile, "View dashboard")
Rel(brand_mobile, partner_app, "Access", "HTTPS")
Rel(partner_app, evermos_brand_be, "Makes API calls to", "HTTPS / REST / JSON")
Rel(evermos_brand_be, db_evm, "Reads from & Writes to", "TCP/IP")
Rel(evermos_brand_be, db_itr, "Reads from & Writes to", "TCP/IP")
```
## Database Design - Existing System
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title EVM Existing Database Schema
entity "[evm] order" as o {
*id: bigint(20)
--
*userId: bigint(20) <<FK>>*
totalBrandPrice: decimal(12)
totalAdminFee: bigint(20)
totalPayment: decimal
totalPrice: decimal
statusShipment: tinyint(3)
.
<<other fields>>
.
isActive: tinyint(1)
createdTime: datetime
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
isActive: tinyint(1)
isRemoved: tinyint(1)
removedTime: datetime
removedBy: bigint(20)
}
entity "[evm] order_receipt" as or {
*id: bigint(20)
--
*orderId: bigint(20) <<FK>>*
additionalAddress: varchar(255)
additionalPhone: varchar(100)
adminFee: int(11)
courierCode: text
courierDiscountPrice: decimal
courierFee: float(12)
pickableDate: datetime
.
<<other fields>>
.
pickupDateTime: timestamp
isCOD: tinyint(1)
isPickedUp : tinyint(1)
isActive: tinyint(1)
isRemoved: tinyint(1)
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
removedTime: datetime
removedBy: bigint(20)
}
o||-right|{ or
```
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title ITR Existing Database Schema
entity "[itr] order" as itr_o {
*id: bigint(20)
--
*userId: bigint(20) <<FK>>*
totalBrandPrice: decimal(12)
totalAdminFee: bigint(20)
totalPayment: decimal
totalPrice: decimal
statusShipment: tinyint(3)
.
<<other fields>>
.
isActive: tinyint(1)
createdTime: datetime
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
isActive: tinyint(1)
isRemoved: tinyint(1)
removedTime: datetime
removedBy: bigint(20)
}
entity "[itr] order_receipt" as itr_or {
*id: bigint(20)
--
*orderId: bigint(20) <<FK>>*
additionalAddress: varchar(255)
additionalPhone: varchar(100)
adminFee: int(11)
courierCode: text
courierDiscountPrice: decimal
courierFee: float(12)
pickableDate: datetime
.
<<other fields>>
.
pickupDateTime: timestamp
isCOD: tinyint(1)
isPickedUp : tinyint(1)
isActive: tinyint(1)
isRemoved: tinyint(1)
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
removedTime: datetime
removedBy: bigint(20)
}
itr_o||-right|{ itr_or
```
## Database Design - Proposed Solution
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title EVM Proposed Database Schema
entity "[evm] order" as o {
*id: bigint(20)
--
*userId: bigint(20) <<FK>>*
totalBrandPrice: decimal(12)
totalAdminFee: bigint(20)
totalPayment: decimal
totalPrice: decimal
statusShipment: tinyint(3)
.
<<other fields>>
.
isActive: tinyint(1)
createdTime: datetime
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
isActive: tinyint(1)
isRemoved: tinyint(1)
removedTime: datetime
removedBy: bigint(20)
}
entity "[evm] order_receipt" as or {
*id: bigint(20)
--
*orderId: bigint(20) <<FK>>*
additionalAddress: varchar(255)
additionalPhone: varchar(100)
adminFee: int(11)
courierCode: text
courierDiscountPrice: decimal
courierFee: float(12)
pickableDate: datetime
.
<<other fields>>
.
<b><color red>isShipmentLabelPrinted: tinyint(1)
<b><color red>shipmentLabelPrintedDate: datetime
pickupDateTime: timestamp
isCOD: tinyint(1)
isPickedUp : tinyint(1)
isActive: tinyint(1)
isRemoved: tinyint(1)
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
removedTime: datetime
removedBy: bigint(20)
}
o||-right|{ or
```
```plantuml
hide circle
'skinparam linetype ortho
skinparam class {
ArrowColor #FF7878
BackgroundColor #FFF89A
BorderColor #694E4E
}
title ITR Proposed Database Schema
entity "[itr] order" as itr_o {
*id: bigint(20)
--
*userId: bigint(20) <<FK>>*
totalBrandPrice: decimal(12)
totalAdminFee: bigint(20)
totalPayment: decimal
totalPrice: decimal
statusShipment: tinyint(3)
.
<<other fields>>
.
isActive: tinyint(1)
createdTime: datetime
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
isActive: tinyint(1)
isRemoved: tinyint(1)
removedTime: datetime
removedBy: bigint(20)
}
entity "[itr] order_receipt" as itr_or {
*id: bigint(20)
--
*orderId: bigint(20) <<FK>>*
additionalAddress: varchar(255)
additionalPhone: varchar(100)
adminFee: int(11)
courierCode: text
courierDiscountPrice: decimal
courierFee: float(12)
pickableDate: datetime
.
<<other fields>>
.
<b><color red>isShipmentLabelPrinted: tinyint(1)
<b><color red>shipmentLabelPrintedDate: datetime
pickupDateTime: timestamp
isCOD: tinyint(1)
isPickedUp : tinyint(1)
isActive: tinyint(1)
isRemoved: tinyint(1)
createdBy: bigint(20)
updatedTime: datetime
updatedBy: bigint(20)
removedTime: datetime
removedBy: bigint(20)
}
itr_o||-right|{ itr_or
```
## evermos-brand-be
### Get Order List
```plantuml
skinparam responseMessageBelowArrow true
title Get Order List - Exsisting Interaction Diagram
participant "client" as c
participant "evermos-brand-be" as ebb
database "evm" as evm
c -> ebb : get order list
activate ebb
alt if client unauthorized
ebb -> c : error unauthorized
end
ebb -> evm : get order list
evm -> ebb : order list data
return order list data
```
```plantuml
skinparam responseMessageBelowArrow true
title Get Order List - Proposed Interaction Diagram
participant "client" as c
participant "evermos-brand-be" as ebb
database "evm" as evm
c -> ebb : get order list
activate ebb
alt if client unauthorized
ebb -> c : error unauthorized
end
ebb -> evm : get order list + filter query (shipmentLabelPrintedStatus)
evm -> ebb : order list data
return order list data
```
### View Order Receipt (Unused)
```plantuml
skinparam responseMessageBelowArrow true
title View Order Receipt - Exsisting Interaction Diagram
participant "client" as c
participant "evermos-brand-be" as ebb
database "itr" as itr
database "evm" as evm
c -> ebb : view order receipt
activate ebb
alt if client unauthorized
ebb -> c : error unauthorized
end
alt if platform ikhtiar
ebb -> itr : view order receipt
itr -> ebb : order receipt data
end
alt if platform evermos
ebb -> evm : view order receipt
evm -> ebb : order receipt data
end
return order receipt data
```
```plantuml
skinparam responseMessageBelowArrow true
title View Order Receipt - Proposed Interaction Diagram
participant "client" as c
participant "evermos-brand-be" as ebb
database "itr" as itr
database "evm" as evm
c -> ebb : view order receipt
activate ebb
alt if client unauthorized
ebb -> c : error unauthorized
end
alt if platform ikhtiar
ebb -> itr : view order receipt
ebb -> itr : update status flag
itr -> ebb : order receipt data
end
alt if platform evermos
ebb -> evm : view order receipt
ebb -> itr : update status flag
evm -> ebb : order receipt data
end
return order receipt data
```
### Update Printed Status
```plantuml
skinparam responseMessageBelowArrow true
title Update Printed Status - Proposed Interaction Diagram
participant "client" as c
participant "evermo-brand-be" as ebb
database "evm" as evm
c -> ebb : update printed status
activate ebb
alt if client unauthorized
ebb -> c : error unauthorized
end
ebb -> evm : update printed status
evm -> ebb : update status
return OK
```