marketplace refactoring
This commit is contained in:
70
README.md
70
README.md
@@ -11,7 +11,7 @@ This FastAPI application provides a complete ecommerce backend solution designed
|
||||
- **JWT Authentication** - Secure user registration, login, and role-based access control
|
||||
- **Marketplace Integration** - Support for multiple marketplaces (Letzshop, Amazon, eBay, Etsy, Shopify, etc.)
|
||||
- **Multi-Shop Management** - Shop creation, ownership validation, and product catalog management
|
||||
- **Advanced Product Management** - GTIN validation, price processing, and comprehensive filtering
|
||||
- **Advanced MarketplaceProduct Management** - GTIN validation, price processing, and comprehensive filtering
|
||||
- **Stock 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
|
||||
@@ -46,7 +46,7 @@ letzshop_api/
|
||||
│ │ ├── main.py # API router setup
|
||||
│ │ └── v1/ # API version 1 routes
|
||||
│ │ ├── auth.py # Authentication endpoints
|
||||
│ │ ├── products.py # Product management
|
||||
│ │ ├── products.py # MarketplaceProduct management
|
||||
│ │ ├── stock.py # Stock operations
|
||||
│ │ ├── shops.py # Shop management
|
||||
│ │ ├── marketplace.py # Marketplace imports
|
||||
@@ -60,7 +60,7 @@ letzshop_api/
|
||||
│ │ ├── base.py # Base model class and common mixins
|
||||
│ │ ├── user.py # User, UserProfile models
|
||||
│ │ ├── auth.py # Authentication-related models
|
||||
│ │ ├── product.py # Product, ProductVariant models
|
||||
│ │ ├── product.py # MarketplaceProduct, ProductVariant models
|
||||
│ │ ├── stock.py # Stock, StockMovement models
|
||||
│ │ ├── shop.py # Shop, ShopLocation models
|
||||
│ │ ├── marketplace.py # Marketplace integration models
|
||||
@@ -69,7 +69,7 @@ letzshop_api/
|
||||
│ ├── __init__.py # Common imports
|
||||
│ ├── base.py # Base Pydantic models
|
||||
│ ├── auth.py # Login, Token, User response models
|
||||
│ ├── product.py # Product request/response models
|
||||
│ ├── product.py # MarketplaceProduct request/response models
|
||||
│ ├── stock.py # Stock operation models
|
||||
│ ├── shop.py # Shop management models
|
||||
│ ├── marketplace.py # Marketplace import models
|
||||
@@ -285,23 +285,23 @@ curl -X POST "http://localhost:8000/api/v1/auth/login" \
|
||||
|
||||
```bash
|
||||
# Get token from login response and use in subsequent requests
|
||||
curl -X GET "http://localhost:8000/api/v1/product" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
```
|
||||
|
||||
## Core Features
|
||||
|
||||
### Product Management
|
||||
### MarketplaceProduct Management
|
||||
|
||||
#### Create a Product
|
||||
#### Create a MarketplaceProduct
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:8000/api/v1/product" \
|
||||
curl -X POST "http://localhost:8000/api/v1/marketplace/product" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"product_id": "PROD001",
|
||||
"title": "Amazing Product",
|
||||
"marketplace_product_id": "PROD001",
|
||||
"title": "Amazing MarketplaceProduct",
|
||||
"description": "An amazing product description",
|
||||
"price": "29.99",
|
||||
"currency": "EUR",
|
||||
@@ -317,15 +317,15 @@ curl -X POST "http://localhost:8000/api/v1/product" \
|
||||
|
||||
```bash
|
||||
# Get all products
|
||||
curl -X GET "http://localhost:8000/api/v1/product" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN"
|
||||
|
||||
# Filter by marketplace
|
||||
curl -X GET "http://localhost:8000/api/v1/product?marketplace=Amazon&limit=50" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product?marketplace=Amazon&limit=50" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN"
|
||||
|
||||
# Search products
|
||||
curl -X GET "http://localhost:8000/api/v1/product?search=Amazing&brand=BrandName" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product?search=Amazing&brand=BrandName" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN"
|
||||
```
|
||||
|
||||
@@ -393,12 +393,12 @@ curl -X GET "http://localhost:8000/api/v1/marketplace/import-status/1" \
|
||||
|
||||
```bash
|
||||
# Export all products
|
||||
curl -X GET "http://localhost:8000/api/v1/product/export-csv" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||
-o products_export.csv
|
||||
|
||||
# Export with filters
|
||||
curl -X GET "http://localhost:8000/api/v1/product/export-csv?marketplace=Amazon&shop_name=MyShop" \
|
||||
curl -X GET "http://localhost:8000/api/v1/marketplace/product?marketplace=Amazon&shop_name=MyShop" \
|
||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||
-o amazon_products.csv
|
||||
```
|
||||
@@ -409,18 +409,18 @@ The system supports CSV imports with the following headers:
|
||||
|
||||
### Required Fields
|
||||
- `product_id` - Unique product identifier
|
||||
- `title` - Product title
|
||||
- `title` - MarketplaceProduct title
|
||||
|
||||
### Optional Fields
|
||||
- `description` - Product description
|
||||
- `link` - Product URL
|
||||
- `image_link` - Product image URL
|
||||
- `description` - MarketplaceProduct description
|
||||
- `link` - MarketplaceProduct URL
|
||||
- `image_link` - MarketplaceProduct image URL
|
||||
- `availability` - Stock availability (in stock, out of stock, preorder)
|
||||
- `price` - Product price
|
||||
- `price` - MarketplaceProduct price
|
||||
- `currency` - Price currency (EUR, USD, etc.)
|
||||
- `brand` - Product brand
|
||||
- `brand` - MarketplaceProduct brand
|
||||
- `gtin` - Global Trade Item Number (EAN/UPC)
|
||||
- `google_product_category` - Product category
|
||||
- `google_product_category` - MarketplaceProduct category
|
||||
- `marketplace` - Source marketplace
|
||||
- `shop_name` - Shop/seller name
|
||||
|
||||
@@ -438,13 +438,16 @@ PROD002,"Super Gadget","A fantastic gadget",19.99,EUR,GadgetInc,9876543210987,Am
|
||||
- `POST /api/v1/auth/login` - Login user
|
||||
- `GET /api/v1/auth/me` - Get current user info
|
||||
|
||||
### Product Endpoints
|
||||
- `GET /api/v1/product` - List products with filtering
|
||||
- `POST /api/v1/product` - Create new product
|
||||
- `GET /api/v1/product/{product_id}` - Get specific product
|
||||
- `PUT /api/v1/product/{product_id}` - Update product
|
||||
- `DELETE /api/v1/product/{product_id}` - Delete product
|
||||
|
||||
### Marketplace Endpoints
|
||||
- `GET /api/v1/marketplace/product` - List marketplace products with filtering
|
||||
- `POST /api/v1/marketplace/product` - Create new marketplace product
|
||||
- `GET /api/v1/marketplace/product/{product_id}` - Get specific marketplace product
|
||||
- `PUT /api/v1/marketplace/product/{product_id}` - Update marketplace product
|
||||
- `DELETE /api/v1/marketplace/product/{product_id}` - Delete marketplace product
|
||||
- `POST /api/v1/marketplace/import-product` - Start CSV import
|
||||
- `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
|
||||
@@ -458,11 +461,6 @@ PROD002,"Super Gadget","A fantastic gadget",19.99,EUR,GadgetInc,9876543210987,Am
|
||||
- `GET /api/v1/shop` - List shops
|
||||
- `GET /api/v1/shop/{shop_code}` - Get specific shop
|
||||
|
||||
### Marketplace Endpoints
|
||||
- `POST /api/v1/marketplace/import-product` - Start CSV import
|
||||
- `GET /api/v1/marketplace/import-status/{job_id}` - Check import status
|
||||
- `GET /api/v1/marketplace/import-jobs` - List import jobs
|
||||
|
||||
### Statistics Endpoints
|
||||
- `GET /api/v1/stats` - Get general statistics
|
||||
- `GET /api/v1/stats/marketplace-stats` - Get marketplace statistics
|
||||
@@ -529,7 +527,7 @@ make docs-help
|
||||
|
||||
### Core Tables
|
||||
- **users** - User accounts and authentication
|
||||
- **products** - Product catalog with marketplace info
|
||||
- **products** - MarketplaceProduct catalog with marketplace info
|
||||
- **stock** - Inventory tracking by location and GTIN
|
||||
- **shops** - Shop/seller information
|
||||
- **shop_products** - Shop-specific product settings
|
||||
@@ -583,7 +581,7 @@ make test-slow
|
||||
# Authentication tests
|
||||
make test-auth
|
||||
|
||||
# Product management tests
|
||||
# MarketplaceProduct management tests
|
||||
make test-products
|
||||
|
||||
# Stock management tests
|
||||
|
||||
Reference in New Issue
Block a user