Background
The current system is hardcoded to a single product (IPHONE15). A real flash-sale platform runs many products concurrently — each with its own inventory, rate limit, and possibly different per-user purchase limits.
Proposed Change
Domain model
Remove the hardcoded defaultProductId assumption. Inventory keys already follow the pattern stock:product:{productId}, so Redis is already multi-product — only the initialisation and health indicator need updating.
New endpoint (or extend existing)
Allow admins to seed inventory for any product:
POST /api/v1/admin/products/{productId}/inventory
Body: { "stock": 500 }
Secured separately (admin role, not general API key).
Per-product config
flashsale:
products:
IPHONE15: { initial-stock: 100, rate-limit: 3 }
PS5: { initial-stock: 50, rate-limit: 1 }
Acceptance Criteria
Background
The current system is hardcoded to a single product (
IPHONE15). A real flash-sale platform runs many products concurrently — each with its own inventory, rate limit, and possibly different per-user purchase limits.Proposed Change
Domain model
Remove the hardcoded
defaultProductIdassumption. Inventory keys already follow the patternstock:product:{productId}, so Redis is already multi-product — only the initialisation and health indicator need updating.New endpoint (or extend existing)
Allow admins to seed inventory for any product:
Secured separately (admin role, not general API key).
Per-product config
Acceptance Criteria
FlashSalePropertiesextended with aproductsmapInventoryConfigseeds all configured products on startupFlashSaleHealthIndicatorreports stock for every configured product