major refactoring adding vendor and customer features
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user