major refactoring adding vendor and customer features
This commit is contained in:
@@ -46,10 +46,10 @@ All API endpoints are versioned using URL path versioning:
|
||||
- Shop-product associations
|
||||
- Shop statistics
|
||||
|
||||
### Stock (`/stock/`)
|
||||
### Inventory (`/inventory/`)
|
||||
- Inventory management
|
||||
- Stock movements
|
||||
- Stock reporting
|
||||
- Inventory movements
|
||||
- Inventory reporting
|
||||
|
||||
### Marketplace (`/marketplace/`)
|
||||
- Import job management
|
||||
|
||||
@@ -32,7 +32,7 @@ app/exceptions/
|
||||
├── marketplace.py # Import/marketplace exceptions
|
||||
├── product.py # MarketplaceProduct management exceptions
|
||||
├── shop.py # Shop management exceptions
|
||||
└── stock.py # Stock management exceptions
|
||||
└── inventory.py # Inventory management exceptions
|
||||
```
|
||||
|
||||
## Core Concepts
|
||||
|
||||
@@ -136,10 +136,10 @@ export const ERROR_MESSAGES = {
|
||||
PRODUCT_ALREADY_EXISTS: 'A product with this ID already exists.',
|
||||
INVALID_PRODUCT_DATA: 'Please check the product information and try again.',
|
||||
|
||||
// Stock errors
|
||||
INSUFFICIENT_STOCK: 'Not enough stock available for this operation.',
|
||||
STOCK_NOT_FOUND: 'No stock information found for this product.',
|
||||
NEGATIVE_STOCK_NOT_ALLOWED: 'Stock quantity cannot be negative.',
|
||||
// Inventory errors
|
||||
INSUFFICIENT_INVENTORY: 'Not enough inventory available for this operation.',
|
||||
INVENTORY_NOT_FOUND: 'No inventory information found for this product.',
|
||||
NEGATIVE_INVENTORY_NOT_ALLOWED: 'Inventory quantity cannot be negative.',
|
||||
|
||||
// Shop errors
|
||||
SHOP_NOT_FOUND: 'Shop not found or no longer available.',
|
||||
@@ -431,26 +431,26 @@ apiClient.interceptors.response.use(
|
||||
);
|
||||
```
|
||||
|
||||
#### Stock Management Errors
|
||||
#### Inventory Management Errors
|
||||
```javascript
|
||||
// components/StockManager.jsx
|
||||
const handleStockUpdate = async (gtin, location, quantity) => {
|
||||
// components/InventoryManager.jsx
|
||||
const handleInventoryUpdate = async (gtin, location, quantity) => {
|
||||
try {
|
||||
await updateStock(gtin, location, quantity);
|
||||
notificationManager.notify('success', 'Stock updated successfully');
|
||||
await updateInventory(gtin, location, quantity);
|
||||
notificationManager.notify('success', 'Inventory updated successfully');
|
||||
} catch (error) {
|
||||
switch (error.errorCode) {
|
||||
case 'INSUFFICIENT_STOCK':
|
||||
case 'INSUFFICIENT_INVENTORY':
|
||||
const { available_quantity, requested_quantity } = error.details;
|
||||
notificationManager.notify('error',
|
||||
`Cannot remove ${requested_quantity} items. Only ${available_quantity} available.`
|
||||
);
|
||||
break;
|
||||
case 'STOCK_NOT_FOUND':
|
||||
notificationManager.notify('error', 'No stock record found for this product');
|
||||
case 'INVENTORY_NOT_FOUND':
|
||||
notificationManager.notify('error', 'No inventory record found for this product');
|
||||
break;
|
||||
case 'NEGATIVE_STOCK_NOT_ALLOWED':
|
||||
notificationManager.notify('error', 'Stock quantity cannot be negative');
|
||||
case 'NEGATIVE_INVENTORY_NOT_ALLOWED':
|
||||
notificationManager.notify('error', 'Inventory quantity cannot be negative');
|
||||
break;
|
||||
default:
|
||||
notificationManager.notifyError(error);
|
||||
|
||||
@@ -97,7 +97,7 @@ if __name__ == "__main__":
|
||||
"description": "A test product for demonstration",
|
||||
"price": "19.99",
|
||||
"brand": "Test Brand",
|
||||
"availability": "in stock",
|
||||
"availability": "in inventory",
|
||||
}
|
||||
|
||||
product_result = create_product(admin_token, sample_product)
|
||||
@@ -207,7 +207,7 @@ curl -X POST "http://localhost:8000/products" \
|
||||
"description": "A test product for demonstration",
|
||||
"price": "19.99",
|
||||
"brand": "Test Brand",
|
||||
"availability": "in stock"
|
||||
"availability": "in inventory"
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Letzshop Import is a powerful web application that enables:
|
||||
- **MarketplaceProduct Management**: Create, update, and manage product catalogs
|
||||
- **Shop Management**: Multi-shop support with individual configurations
|
||||
- **CSV Import**: Bulk import products from various marketplace formats
|
||||
- **Stock Management**: Track inventory across multiple locations
|
||||
- **Inventory Management**: Track inventory across multiple locations
|
||||
- **User Management**: Role-based access control for different user types
|
||||
- **Marketplace Integration**: Import from various marketplace platforms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user