@withpotter/product — module reference
HTTP routes this module mounts, plus its internal use-cases, entities, and repositories. The exhaustive request/response contract is the engine’s OpenAPI document at /docs; the layered structure below follows the package internal architecture.
HTTP routes
Products /products
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /products | — | List products with filters |
GET | /products/:id | — | Get a product by ID |
GET | /products/featured | — | Get featured products |
GET | /products/low-stock | Yes | Get products with low stock |
GET | /products/slug/:slug | — | Get a product by slug |
POST | /products | Yes | Create a new product |
POST | /products/:id/inventory/release | Yes | Release reserved stock |
POST | /products/:id/inventory/reserve | Yes | Reserve stock for an order |
PUT | /products/:id | Yes | Update a product |
PATCH | /products/:id/inventory | Yes | Update product inventory quantity |
DELETE | /products/:id | Yes | Delete a product |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
CreateProductUseCase | execute(tenantId: string, dto: CreateProductDto): Promise<ProductResponseDto> |
DeleteProductUseCase | execute(tenantId: string, productId: string): Promise<void> |
GetFeaturedProductsUseCase | execute(tenantId: string, limit = 10): Promise<ProductResponseDto[]> |
GetLowStockUseCase | execute(tenantId: string): Promise<ProductResponseDto[]> |
GetProductBySlugUseCase | execute(tenantId: string, slug: string): Promise<ProductResponseDto> |
GetProductUseCase | execute(tenantId: string, productId: string): Promise<ProductResponseDto> |
ListProductsUseCase | execute(tenantId: string, query: ProductQueryDto): Promise<ProductListResponseDto> |
ReleaseStockUseCase | execute(tenantId: string, productId: string, amount: number): Promise<void> |
ReserveStockUseCase | execute(tenantId: string, productId: string, amount: number): Promise<{ success: boolean; available: number }> |
UpdateInventoryUseCase | execute(tenantId: string, productId: string, quantity: number): Promise<ProductResponseDto> |
UpdateProductUseCase | execute(tenantId: string, productId: string, dto: UpdateProductDto): Promise<ProductResponseDto> |
Generated from the module’s source. Routes are relative to the engine root
(default http://localhost:3001). For full request/response schemas use the live
OpenAPI document.