---
# System prepended metadata

title: Product QC Page

---

# Product QC Page

# Phase 1

## Architecture Diagram - Proposed Solution

```plantuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml

title Product QC

Person(brand_admin, "Brand Admin")
System_Boundary(admin_web_system, "Evermos Administration Web Application") {
    Container(brand_web, "Browser", "Software System", "All supported browser")
    Container(evermos_fe, "Evermos Web Application", "Nuxt.js", "Provides catalog, order, and other transactions management functionalities via web 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(product_api, "evm-product-admin API", "Golang", "Provides product management functionalities via HTTPS / REST / JSON API") 


    ContainerDb(db_evm, "Database", "MySQL", "evm schema")
    ContainerDb(db_draft, "Database", "MySQL", "draft schema")
    ContainerDb(db_gss_productCategory, "Database", "GSS", "productCategory index")
    ContainerDb(db_gss_product, "Database", "GSS", "product index")
    ContainerDb(db_gss_productDraft, "Database", "GSS", "variantQc index (new)")
}

Rel_R(brand_admin, brand_web, "Register Brand", "Client Device")
Rel_R(brand_web, evermos_fe, "Access", "HTTPS")
Rel_R(evermos_fe, admin_web_app, "Access", "HTTPS")
Rel(admin_web_app, product_api, "Makes API calls to", "HTTPS / REST / JSON")


Rel(product_api, db_gss_productCategory, "Reads from", "TCP/IP")
Rel(product_api, db_gss_product, "Reads from", "TCP/IP")
Rel(product_api, db_gss_productDraft, "Reads from", "TCP/IP")
Rel(product_api, db_evm, "Reads from & Writes to", "TCP/IP")
Rel(product_api, db_draft, "Reads from & Writes", "TCP/IP")
```

## Database Design

```plantuml
hide circle
'skinparam linetype ortho

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

title Product QC - Product Management - Proposed Database Schema

package evm <<Database>> {
    entity "brand" as eb {
        *id : bigint(20) <<generated>>
        --
        name : varchar(100)
        stockLocation : int(11)
        isActive : tinyint(1)
    }
    
    entity "product_model" as epm {
        *id : bigint(20) <<generated>>
        --
        *brandId : bigint(20) <<FK>>
        name : text
        normalPrice : float
        discountPrice : float
        minPrice : float
        maxPrice : float
        minResellerPrice : int(11)
        maxResellerPrice : int(11)
        minVendorPrice : float
        maxVendorPrice : float
        quantity : int(11)
        stockLocation : int(11)
        isPo : tinyint(1)
        isCOD : tinyint(3)
        isActive : tinyint(1)
        oldIsActive : tinyint(1)
    }

    entity "product" as ep {
        *id : bigint(20) <<generated>>
        --
        *productModelId : bigint(20) <<FK>>
        name : text
        normalPrice : float
        discountPrice : float
        quantity : int(11)
        stockLocation : int(11)
        isCOD : tinyint(3)
        isPo : tinyint(1)
        isActive : tinyint(1)
        oldIsActive : tinyint(1)
    }
}

package draft <<Database>> {
    entity "draft" as epdd {
        *entity_id : char(36)
        --
        *reference_draft_id : char(36) <<FK>>
        *brand_id : varchar(36) <<FK>>
        brand_name : varchar(100)
        data_draft_type : enum(new,update)
        draft_status : enum(open,replaced,closed)
        notes : varchar(255)
        draft_source : varchar(50)
        --
        requested_at : timestamp
        requested_by : varchar(36)
        checked_at : timestamp
        checked_by : varchar(36)
        closed_at : timestamp
        closed_by : varchar(36)
    }
    
    entity "product_draft" as epdpd {
        *entity_id : char(36)
        --
        *draft_id : char(36) <<FK>>
        *product_id : varchar(36) <<FK>>
        commission_type : enum(nominal,percentage)
        reseller_commission : decimal(12,2)
        evermos_commission : decimal(12,2)
        total_commission : decimal(12,2)
        before_changes : json
        after_changes : json
        qc_status : varchar(20)
        notes : varchar(255)
        --
        requested_at : timestamp
        requested_by : varchar(36)
        checked_at : timestamp
        checked_by : varchar(36)
    }
    
    entity "variant_draft_reason" as epdrd #C4DFAA {
        entity_id : char(36)
        --
        reason_id : int <<FK>>
        variant_draft_id : varchar(36) <<FK>>
        notes : varchar(255)
        --
        created_at : timestamp
        created_by : varchar(36)
        updated_at : timestamp
        updated_by : varchar(36)
        deleted_at : timestamp
        deleted_by : varchar(36)
        is_active : tinyint(1)
        is_deleted : tinyint(1)
    }
    
    entity "reason" as epdr #C4DFAA {
        id : int
        --
        reason : varchar(36)
        parent_id : int
        is_has_notes : tinyint(1)
    }
    
    entity "variant_draft" as epdvd {
        *entity_id : char(36)
        --
        *product_id : varchar(36) <<FK>>
        *variant_id : varchar(36) <<FK>>
        retail_price : decimal(12,2)
        discount_price : decimal(12,2)
        before_changes : json
        after_changes : json
        qc_status : varchar(20)
        notes : varchar(255)
        <b><color #FF8787>confirmation_notes : varchar(255)
        --
        requested_at : timestamp
        requested_by : varchar(36)
        checked_at : timestamp
        checked_by : varchar(36)
    }
}

epm ||-right|{ ep
eb ||--|{ epm

eb ||-down|{ epdd
epdd ||--|{ epdpd
    
epm ||--|{ epdpd
epdd ||--|{ epdvd
ep ||--|{ epdvd
    
epdrd ||--|{ epdr
epdvd ||--|{ epdrd
```

## Proces Flow

```plantuml
skinparam responseMessageBelowArrow true

title Product QC List - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "gss" as e
database "evm" as d

c -> ep : product QC List
activate ep

ep -> e : search productCategory
e -> ep : list productCategory

ep -> e : search product
e -> ep : list product

ep -> e : search <b><color #90C8AC>variantQC
e -> ep : list <b><color #90C8AC>variantQC

ep -> d : search category
d -> ep : list category


return list product QC
```

```plantuml
skinparam responseMessageBelowArrow true

title Product QC Count - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "gss" as e
database "evm" as d

c -> ep : product QC Count
activate ep

ep -> e : search productCategory
e -> ep : list productCategory

ep -> e : search product
e -> ep : list product

ep -> e : search <b><color #90C8AC>variantQC
e -> ep : list <b><color #90C8AC>variantQC

ep -> d : search category
d -> ep : list category


return count product QC
```

```plantuml
skinparam responseMessageBelowArrow true

title History QC - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "draft" as e

c -> ep : history variant draft
activate ep

ep -> e : search variantDraft
e -> ep : list variantDraft

return list history variant draft
```

```plantuml
skinparam responseMessageBelowArrow true

title Product Changes List - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "gss" as e
database "evm" as d

c -> ep : product QC Changes
activate ep

ep -> e : search product
e -> ep : list product

ep -> d : search productDraft
d -> ep : list productDraft

return list product changes
```

```plantuml
skinparam responseMessageBelowArrow true

title Variant Changes List - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "gss" as e
database "evm" as d

c -> ep : variant QC Changes
activate ep

ep -> e : search <b><color #90C8AC>variantQC
e -> ep : list <b><color #90C8AC>variantQC

ep -> d : search variant
d -> ep : list variant

ep -> d : search variantDraft
d -> ep : list variantDraft

return list variant changes
```

```plantuml
skinparam responseMessageBelowArrow true

title Reason List - Proposed Interaction Diagram

participant "client" as c
participant "evm-product" as ep
database "draft" as e

c -> ep : reason list
activate ep

ep -> e : search reason
e -> ep : list reason

return list reason
```