SR-023 — Package Master: Administration System Requirements
| Metadata | Details |
|---|---|
| System Name | inventory-service — Package Master |
| Document ID | SR-2026-INV-004 |
| Author | Engineering Team |
| Status | Approved |
Traces back to BRD-022.
This document covers inventory-service’s PackageMasterService (Go, PostgreSQL, Echo REST, /inventory/admin/api/v1/package-masters) and the ui-admin-application’s features/packageMaster/ admin UI that drives it. Unlike Warehouse Master, every field here is fully local to inventory-service — no pii-service integration exists or is needed, since a packaging type carries no personal data.
Functional Requirements
Package Master List Page (PackageMasterPage.tsx, route /package-masters)
FR-01 (List & Filter): The list page retrieves every packaging type for the caller’s tenant via GET /inventory/admin/api/v1/package-masters, displaying each row’s package code and status dot, plus its name and material-type label. A text-search box and a status-value dropdown filter the list; no column sort is offered — the same list-page shape Warehouse Master’s FR-01 uses. The list response omits internal dimensions and tare weight, returning only the fields the list columns display.
Package Master Entry/Edit Form (pages/PackageMasterFormPage.tsx, route /package-masters/new and /package-masters/:id/edit)
FR-02 (Basic Info Section): The form’s Basic Info section captures package_code (required, unique per tenant), package_name (required), and package_material_type (one of BOX/FLYER/POLY_BAG/WRAPPER, default BOX).
FR-03 (External Dimensions Section): The form’s External Dimensions section captures ext_length/ext_width/ext_height (each a positive decimal), representing the packaging type’s outer, as-shipped footprint.
FR-04 (Internal Dimensions Section): The form’s Internal Dimensions section captures int_length/int_width/int_height (each a positive decimal), representing the usable interior space available for a product.
FR-05 (Weight & Capacity Section): The form’s Weight & Capacity section captures tare_weight (the empty packaging’s own weight, default 0.000, non-negative) and max_weight (the maximum total weight the packaging type is rated for, positive).
FR-06 (Field Validation, Frontend and Backend Consistent): Every FR-02 through FR-05 field’s required/positive-value rule is enforced both in PackageMasterFormPage.tsx’s client-side validation and in inventory-service’s own domain validation (domain/packagemaster_validation.go) — unlike Warehouse Master’s FR-05, the two layers agree. package_material_type’s enum values are validated only in application code, not as a database CHECK constraint. (Gap — see Technical Debt — TD-00017.)
FR-07 (Create): Submitting a new packaging type calls POST /inventory/admin/api/v1/package-masters, inserting the row with status = DRAFT.
FR-08 (Update): Submitting an edit calls PUT /inventory/admin/api/v1/package-masters/:id.
FR-09 (Publish): A DRAFT or ARCHIVED packaging type is made available for use via POST /inventory/admin/api/v1/package-masters/:id/publish, transitioning status to PUBLISHED, per ADR-00037 — the identical lifecycle Warehouse Master uses.
FR-10 (Archive): A PUBLISHED packaging type is retired via PATCH /inventory/admin/api/v1/package-masters/:id/archive.
FR-11 (Delete, Draft-Only): DELETE /inventory/admin/api/v1/package-masters/:id is permitted only while status = DRAFT.
FR-12 (Downstream Consumers): A published packaging type is read by product-catalog’s product wizard Step 8 (“Package Map,” via sku_box_mapping.box_id) to assign a packaging type to a SKU, and by checkout’s volumetric-weight calculation, which maps a SKU’s largest-by-volume assigned box and computes (ext_length × ext_width × ext_height) / 5000 + tare_weight — a known v1 simplification, not real bin-packing, per inventory-service’s own notes.
Non-Functional Requirements
Composition & Reuse
ui-admin-application’s features/packageMaster/PackageMasterRepository.ts is the only file in the feature that imports apiClient. The backend’s repository/packagemaster/ follows the identical entity/mapper/interface/implementation split repository/warehouse/ uses, consistent with the monorepo’s global microservice layer conventions (.claude/rules/00-global-microservice-rules.md).
Multi-Tenancy & Auth Propagation
Every REST call carries the caller’s tenant/user/role via the standard AuthClaims header contract; tenant_id/created_user_id/updated_user_id on "inventory-service".package_master are sourced from the auth context, never the request body, per the mandatory five-field audit contract.
Database-Level Enum Enforcement
package_material_type has no database CHECK constraint backing its four allowed values — only domain/packagemaster_validation.go’s application-level check prevents an invalid value. A row inserted by any path that bypasses this service’s own validation (a direct database write, a future bulk-import path) could carry an unrecognized material type.
Related Documents
- BRD-022 — Package Master: Maintaining the Catalog of Shippable Container Types
- ADR-00037 — DRAFT/PUBLISHED/ARCHIVED Lifecycle for Admin-Maintained Master Data
- SR-022 — Warehouse Master: Administration System Requirements — the sibling master-data feature sharing the same lifecycle and list/form page shape
- Architecture — Package Master: Administration Console
- Technical Debt — Package Master Gaps
- Microservices: inventory-service