major refactoring adding vendor and customer features

This commit is contained in:
2025-10-11 09:09:25 +02:00
parent f569995883
commit dd16198276
126 changed files with 15109 additions and 3747 deletions

View File

@@ -1,6 +1,6 @@
# Ecommerce Backend API with Marketplace Support
A comprehensive FastAPI-based product management system with JWT authentication, marketplace-aware CSV import/export, multi-shop support, and advanced stock management capabilities.
A comprehensive FastAPI-based product management system with JWT authentication, marketplace-aware CSV import/export, multi-shop support, and advanced inventory management capabilities.
## Overview
@@ -12,7 +12,7 @@ This FastAPI application provides a complete ecommerce backend solution designed
- **Marketplace Integration** - Support for multiple marketplaces (Letzshop, Amazon, eBay, Etsy, Shopify, etc.)
- **Multi-Shop Management** - Shop creation, ownership validation, and product catalog management
- **Advanced MarketplaceProduct Management** - GTIN validation, price processing, and comprehensive filtering
- **Stock Management** - Multi-location inventory tracking with add/remove/set operations
- **Inventory Management** - Multi-location inventory tracking with add/remove/set operations
- **CSV Import/Export** - Background processing of marketplace CSV files with progress tracking
- **Rate Limiting** - Built-in request rate limiting for API protection
- **Admin Panel** - Administrative functions for user and shop management
@@ -47,7 +47,7 @@ letzshop_api/
│ │ └── v1/ # API version 1 routes
│ │ ├── auth.py # Authentication endpoints
│ │ ├── products.py # MarketplaceProduct management
│ │ ├── stock.py # Stock operations
│ │ ├── inventory.py # Inventory operations
│ │ ├── shops.py # Shop management
│ │ ├── marketplace.py # Marketplace imports
│ │ ├── admin.py # Admin functions
@@ -61,7 +61,7 @@ letzshop_api/
│ │ ├── user.py # User, UserProfile models
│ │ ├── auth.py # Authentication-related models
│ │ ├── product.py # MarketplaceProduct, ProductVariant models
│ │ ├── stock.py # Stock, StockMovement models
│ │ ├── inventory.py # Inventory, InventoryMovement models
│ │ ├── shop.py # Shop, ShopLocation models
│ │ ├── marketplace.py # Marketplace integration models
│ │ └── admin.py # Admin-specific models
@@ -70,7 +70,7 @@ letzshop_api/
│ ├── base.py # Base Pydantic models
│ ├── auth.py # Login, Token, User response models
│ ├── product.py # MarketplaceProduct request/response models
│ ├── stock.py # Stock operation models
│ ├── inventory.py # Inventory operation models
│ ├── shop.py # Shop management models
│ ├── marketplace.py # Marketplace import models
│ ├── admin.py # Admin operation models
@@ -307,7 +307,7 @@ curl -X POST "http://localhost:8000/api/v1/marketplace/product" \
"currency": "EUR",
"brand": "BrandName",
"gtin": "1234567890123",
"availability": "in stock",
"availability": "in inventory",
"marketplace": "Letzshop",
"shop_name": "MyShop"
}'
@@ -329,12 +329,12 @@ curl -X GET "http://localhost:8000/api/v1/marketplace/product?search=Amazing&bra
-H "Authorization: Bearer YOUR_TOKEN"
```
### Stock Management
### Inventory Management
#### Set Stock Quantity
#### Set Inventory Quantity
```bash
curl -X POST "http://localhost:8000/api/v1/stock" \
curl -X POST "http://localhost:8000/api/v1/inventory" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
@@ -344,10 +344,10 @@ curl -X POST "http://localhost:8000/api/v1/stock" \
}'
```
#### Add Stock
#### Add Inventory
```bash
curl -X POST "http://localhost:8000/api/v1/stock/add" \
curl -X POST "http://localhost:8000/api/v1/inventory/add" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
@@ -357,10 +357,10 @@ curl -X POST "http://localhost:8000/api/v1/stock/add" \
}'
```
#### Check Stock Levels
#### Check Inventory Levels
```bash
curl -X GET "http://localhost:8000/api/v1/stock/1234567890123" \
curl -X GET "http://localhost:8000/api/v1/inventory/1234567890123" \
-H "Authorization: Bearer YOUR_TOKEN"
```
@@ -415,7 +415,7 @@ The system supports CSV imports with the following headers:
- `description` - MarketplaceProduct description
- `link` - MarketplaceProduct URL
- `image_link` - MarketplaceProduct image URL
- `availability` - Stock availability (in stock, out of stock, preorder)
- `availability` - Inventory availability (in inventory, out of inventory, preorder)
- `price` - MarketplaceProduct price
- `currency` - Price currency (EUR, USD, etc.)
- `brand` - MarketplaceProduct brand
@@ -448,13 +448,13 @@ PROD002,"Super Gadget","A fantastic gadget",19.99,EUR,GadgetInc,9876543210987,Am
- `GET /api/v1/marketplace/import-status/{job_id}` - Check import status
- `GET /api/v1/marketplace/import-jobs` - List import jobs
-
### Stock Endpoints
- `POST /api/v1/stock` - Set stock quantity
- `POST /api/v1/stock/add` - Add to stock
- `POST /api/v1/stock/remove` - Remove from stock
- `GET /api/v1/stock/{gtin}` - Get stock by GTIN
- `GET /api/v1/stock/{gtin}/total` - Get total stock
- `GET /api/v1/stock` - List all stock entries
### Inventory Endpoints
- `POST /api/v1/inventory` - Set inventory quantity
- `POST /api/v1/inventory/add` - Add to inventory
- `POST /api/v1/inventory/remove` - Remove from inventory
- `GET /api/v1/inventory/{gtin}` - Get inventory by GTIN
- `GET /api/v1/inventory/{gtin}/total` - Get total inventory
- `GET /api/v1/inventory` - List all inventory entries
### Shop Endpoints
- `POST /api/v1/shop` - Create new shop
@@ -528,7 +528,7 @@ make docs-help
### Core Tables
- **users** - User accounts and authentication
- **products** - MarketplaceProduct catalog with marketplace info
- **stock** - Inventory tracking by location and GTIN
- **inventory** - Inventory tracking by location and GTIN
- **shops** - Shop/seller information
- **shop_products** - Shop-specific product settings
- **marketplace_import_jobs** - Background import job tracking
@@ -536,7 +536,7 @@ make docs-help
### Key Relationships
- Users own shops (one-to-many)
- Products belong to marketplaces and shops
- Stock entries are linked to products via GTIN
- Inventory entries are linked to products via GTIN
- Import jobs track user-initiated imports
## Security Features
@@ -584,8 +584,8 @@ make test-auth
# MarketplaceProduct management tests
make test-products
# Stock management tests
make test-stock
# Inventory management tests
make test-inventory
# Marketplace functionality tests
make test-marketplace
@@ -714,7 +714,7 @@ This will display all available commands organized by category:
### v2.2.0
- Added marketplace-aware product import
- Implemented multi-shop support
- Enhanced stock management with location tracking
- Enhanced inventory management with location tracking
- Added comprehensive test suite
- Improved authentication and authorization