Architecture — Package Master: Administration Console

By Engineering Team•October 9, 2026•5 min read
Metadata Details
System inventory-service — Package Master
Document ID ARCH-2026-INV-004
Author Engineering Team
Status Approved

Implements SR-023, per the lifecycle decision in ADR-00037.


Components

Component Language/Runtime Role
PackageMasterPage.tsx React (admin UI) List + filter packaging types
pages/PackageMasterFormPage.tsx / pages/PackageMasterFormController.ts React (admin UI) Create/edit form (Basic Info, External/Internal Dimensions, Weight & Capacity)
PackageMasterRepository.ts React/Axios (admin UI) Sole apiClient consumer for this feature
transport/api/packagemaster/ Go (Echo REST) inventory-service’s package-master controller
service/packagemaster/ Go Lifecycle transitions and validation orchestration
repository/packagemaster/ Go (PostgreSQL) "inventory-service".package_master persistence
product-catalog (consumer) Go Product wizard Step 8 reads published packaging types for sku_box_mapping

End-to-end flow (A) — Create and publish a packaging type

  1. Admin fills Basic Info/External Dimensions/Internal Dimensions/Weight & Capacity in PackageMasterFormPage.tsx (SR-023 FR-02–FR-05) and submits.
  2. PackageMasterRepository.ts calls POST /inventory/admin/api/v1/package-masters.
  3. transport/api/packagemaster/ maps the request and calls service/packagemaster/Create, which validates every field via domain/packagemaster_validation.go (SR-023 FR-06) before inserting the row (status = DRAFT) via repository/packagemaster/.
  4. Once ready, the admin calls POST .../:id/publish, transitioning status to PUBLISHED (SR-023 FR-09).

End-to-end flow (B) — Archive / Delete

  1. Archive (PATCH .../:id/archive): transitions a PUBLISHED row to ARCHIVED (SR-023 FR-10).
  2. Delete (DELETE .../:id, DRAFT only): removes the row entirely (SR-023 FR-11) — no compensating external call is needed, since every field is local to this table.

End-to-end flow (C) — Downstream consumption

  1. product-catalog’s product-setup wizard Step 8 (“Package Map”) reads PUBLISHED packaging types and writes the admin’s chosen mapping into sku_box_mapping.box_id (SR-023 FR-12).
  2. At checkout, the volumetric-weight calculation resolves a SKU’s assigned packaging type, computes (ext_length × ext_width × ext_height) / 5000 + tare_weight, and uses the larger of that result and the SKU’s actual weight for shipping-cost purposes.

Why this is simple, and what it does not yet guarantee

Package Master has no external service dependency — every field it owns is fully local to "inventory-service".package_master, so its create/publish/archive/delete flows are single-service, single-transaction operations with no compensating-write concern the way Warehouse Master’s PII split has.

This flow does not yet guarantee that package_material_type can only ever hold one of its four intended values — that constraint exists only in domain/packagemaster_validation.go, not as a database CHECK constraint, so a write that bypasses this service’s own validation path could persist an unrecognized value. Tracked in Technical Debt — TD-00017.