@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

MethodPathAuthDescription
GET/productsList products with filters
GET/products/:idGet a product by ID
GET/products/featuredGet featured products
GET/products/low-stockYesGet products with low stock
GET/products/slug/:slugGet a product by slug
POST/productsYesCreate a new product
POST/products/:id/inventory/releaseYesRelease reserved stock
POST/products/:id/inventory/reserveYesReserve stock for an order
PUT/products/:idYesUpdate a product
PATCH/products/:id/inventoryYesUpdate product inventory quantity
DELETE/products/:idYesDelete a product

Internals

Use-cases

Application operations. Each is a single-purpose class with one execute() method.

Use-caseSignature
CreateProductUseCaseexecute(tenantId: string, dto: CreateProductDto): Promise<ProductResponseDto>
DeleteProductUseCaseexecute(tenantId: string, productId: string): Promise<void>
GetFeaturedProductsUseCaseexecute(tenantId: string, limit = 10): Promise<ProductResponseDto[]>
GetLowStockUseCaseexecute(tenantId: string): Promise<ProductResponseDto[]>
GetProductBySlugUseCaseexecute(tenantId: string, slug: string): Promise<ProductResponseDto>
GetProductUseCaseexecute(tenantId: string, productId: string): Promise<ProductResponseDto>
ListProductsUseCaseexecute(tenantId: string, query: ProductQueryDto): Promise<ProductListResponseDto>
ReleaseStockUseCaseexecute(tenantId: string, productId: string, amount: number): Promise<void>
ReserveStockUseCaseexecute(tenantId: string, productId: string, amount: number): Promise<{ success: boolean; available: number }>
UpdateInventoryUseCaseexecute(tenantId: string, productId: string, quantity: number): Promise<ProductResponseDto>
UpdateProductUseCaseexecute(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.