Platform modules
Catalog, products and images
Build a product catalog with brands, categories, controlled stock changes and file-backed images.
Prepare the catalog records
Catalog supplies brands, hierarchical categories, products and product images. Its routes are under /api/v1/catalog. Start by creating a brand and category, then a product that references their IDs. Keep the records inside the same tenant context.
Product creation takes SKU, name, description, brand ID, category ID, price amount, price currency and opening stock. The domain trims and uppercases the SKU, derives a slug from the name and rejects negative opening price or stock. A category or brand ID cannot be empty.
Work through a product example
- Create a brand through
POST /api/v1/catalog/brands. - Create a category through
POST /api/v1/catalog/categories. Use/categories/treeto inspect the resulting hierarchy. - Create the product through
POST /api/v1/catalog/productsusing the actual brand and category IDs. - Retrieve
/products/{id}and verify SKU, currency, price and stock. - Upload a product image through Files, then attach its file ID and URL to the product's image collection.
Use a synthetic item for this walkthrough. Creation establishes a catalog record; any procurement, reservation or fulfillment workflow belongs to the application you build around it.
Price and stock are separate operations
| Task | Route beneath /api/v1/catalog |
Permission |
|---|---|---|
| Read products | GET /products |
Permissions.Catalog.Products.View |
| Change details | PUT /products/{id} |
Permissions.Catalog.Products.Update |
| Change price | PATCH /products/{id}/price |
Permissions.Catalog.Products.Update |
| Adjust stock | PATCH /products/{id}/stock |
Permissions.Catalog.Products.AdjustStock |
| Restore a product | POST /products/{id}/restore |
Permissions.Catalog.Products.Restore |
Stock adjustment applies a delta to the current quantity and refuses a result below zero. Use the dedicated operation rather than treating the number as an unrestricted field edit. Price changes and stock changes produce domain events, allowing the platform's event processing to observe them.
Manage the product gallery
Images form a subresource at /products/{id}/images. The first image becomes the thumbnail. Selecting another thumbnail clears that flag from the others; removing the current thumbnail promotes the remaining image with the lowest sort order. The ordering operation accepts image IDs and appends omitted images in their existing order.
Catalog registers a Product file access policy and an integration handler for stored file moves. Keep the FileAssetId association when using managed uploads so the application can relate the image to its file record.
Verify and troubleshoot
Check that a reader can list a product but cannot change stock without AdjustStock. Test a decrement that would make stock negative and confirm it is rejected. Change the thumbnail, remove it and verify the replacement cover. Check the trash and restore permissions separately from ordinary viewing.
For a missing product, confirm tenant context, soft-deletion status and the supplied ID. For a failed upload, inspect the Files category, owner policy and finalization rather than repeatedly creating product rows. When extending Catalog, preserve the aggregate methods so price, stock and thumbnail rules stay consistent.