Architecture — Warehouse Master: Administration Console and PII-Backed Address Storage
| Metadata | Details |
|---|---|
| System | inventory-service — Warehouse Master |
| Document ID | ARCH-2026-INV-003 |
| Author | Engineering Team |
| Status | Approved |
Implements SR-022, per the decisions in ADR-00037 (lifecycle) and ADR-00019 (why address/contact data lives in pii-service).
Components
| Component | Language/Runtime | Role |
|---|---|---|
WarehousePage.tsx / WarehouseController.ts |
React (admin UI) | List + filter warehouses |
pages/WarehouseFormPage.tsx / pages/WarehouseFormController.ts |
React (admin UI) | Create/edit form (Basic Info, Address, Contact sections) |
WarehouseRepository.ts |
React/Axios (admin UI) | Sole apiClient consumer for this feature |
transport/api/warehouse/ |
Go (Echo REST) | inventory-service’s warehouse controller |
service/warehouse/ |
Go | Orchestrates the local Postgres write and the pii-service gRPC call per request |
repository/warehouse/ |
Go (PostgreSQL) | "inventory-service".warehouse persistence — code, description, status, is_main, audit fields |
pii-service (gRPC client call) |
Go → Rust (gRPC) | UpsertAttributes/GetAttributes/DeleteAttributes against address/contact fields, keyed by the warehouse’s UUID as entity_id, PiiEntityType = "warehouse" |
End-to-end flow (A) — Create a warehouse
- Admin fills the Basic Info/Address/Contact sections in
WarehouseFormPage.tsx(SR-022 FR-02–FR-04) and submits. WarehouseRepository.tscallsPOST /inventory/admin/api/v1/warehouseswith the full payload.transport/api/warehouse/maps the request into a domain DTO and callsservice/warehouse/Create.service/warehouse/Createinserts the local row (status = DRAFT,tenant_id/created_user_id/created_atfromAuthClaims) viarepository/warehouse/, receiving back the new warehouse’s UUID (SR-022 FR-06).- In the same request,
service/warehouse/Createcallspii-service’sUpsertAttributeswith the Address/Contact fields,entity_id = <warehouse UUID>,PiiEntityType = "warehouse". - The combined (local-row + confirmed-PII-write) result is returned to the admin UI; the warehouse now exists in
DRAFT.
End-to-end flow (B) — Load and edit a warehouse
WarehouseFormPage.tsxcallsGET /inventory/admin/api/v1/warehouses/:idon load.service/warehouse/Getreads the local row fromrepository/warehouse/, then callspii-service’sGetAttributesfor the sameentity_id/PiiEntityType.- The two results are flattened into one response object — Basic Info from the local row, Address/Contact from
pii-service— and returned; they are never persisted together, only combined at this response-assembly point (SR-022 FR-03/FR-04). - On submit,
PUT /inventory/admin/api/v1/warehouses/:idrepeats flow (A)‘s steps 3–5 as an update rather than an insert (SR-022 FR-07).
End-to-end flow (C) — Publish / Archive / Delete
- Publish (
POST .../:id/publish):service/warehouse/PublishtransitionsstatusfromDRAFTorARCHIVEDtoPUBLISHED(SR-022 FR-08) — a local-row-only update, nopii-servicecall. - Archive (
PATCH .../:id/archive):service/warehouse/ArchivetransitionsstatusfromPUBLISHEDtoARCHIVED(SR-022 FR-09) — local-row-only. - Delete (
DELETE .../:id,DRAFTonly):service/warehouse/Deletedeletes the local row, then callspii-service’sDeleteAttributesfor the sameentity_idas a compensating step (SR-022 FR-10).
Why this separates cleanly, and what it does not yet guarantee
Splitting the warehouse row (identity, lifecycle, is_main) from its PII payload (address/contact) means inventory-service’s own schema never has to classify or protect personal data itself — that responsibility stays entirely inside pii-service’s AES-256-GCM-backed EAV store, correlated purely by the warehouse UUID as an opaque entity_id. A reader of "inventory-service".warehouse alone sees no personal data at all.
This flow does not yet guarantee: (a) that every Address/Contact field is actually present and well-formed — that validation runs only in the admin UI’s WarehouseFormController.ts, not in service/warehouse/; (b) that a failed DeleteAttributes call in flow (C)‘s delete step is retried — a local row can be deleted while its pii-service attributes remain orphaned; (c) that an administrator can view or reassign which warehouse is flagged is_main. All three are tracked in Technical Debt — TD-00016.
Related Documents
- BRD-021 — Warehouse Master: Maintaining the Directory of Fulfillment Locations
- SR-022 — Warehouse Master: Administration System Requirements
- ADR-00037 — DRAFT/PUBLISHED/ARCHIVED Lifecycle for Admin-Maintained Master Data
- ADR-00019 — Dedicated pii-service vs. Duplicated Per-Service Handling
- Technical Debt — Warehouse Master Gaps
- Admin UI Walkthrough — Warehouse Master
- Microservices: inventory-service, pii-service