feat: extract inventory, orders, and marketplace modules (Phase 4)

Extract three additional modules following the billing module pattern:

Inventory Module (app/modules/inventory/):
- Stock management and tracking
- Inventory locations
- Low stock alerts
- Admin and vendor routes with module access control

Orders Module (app/modules/orders/):
- Order management and fulfillment
- Order item exceptions
- Bulk operations and export
- Admin and vendor routes with module access control

Marketplace Module (app/modules/marketplace/):
- Letzshop integration
- Product sync
- Marketplace import
- Depends on inventory module
- Admin and vendor routes with module access control

Admin router updated:
- Uses module routers with require_module_access dependency
- Legacy router includes commented out
- Routes verified: 15 inventory, 16 orders, 42 marketplace

All 31 module tests passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-25 22:02:24 +01:00
parent c614b7d74c
commit 9d0dc51de0
17 changed files with 559 additions and 83 deletions

View File

@@ -21,6 +21,9 @@ from models.database.admin_menu_config import FrontendType
# Import extracted modules
from app.modules.billing.definition import billing_module
from app.modules.inventory.definition import inventory_module
from app.modules.marketplace.definition import marketplace_module
from app.modules.orders.definition import orders_module
# =============================================================================
@@ -84,69 +87,12 @@ MODULES: dict[str, ModuleDefinition] = {
# =========================================================================
# Billing module - imported from app/modules/billing/
"billing": billing_module,
"inventory": ModuleDefinition(
code="inventory",
name="Inventory Management",
description="Stock levels, locations, and low stock alerts.",
features=[
"inventory_basic",
"inventory_locations",
"low_stock_alerts",
"inventory_purchase_orders",
"product_management",
],
menu_items={
FrontendType.ADMIN: [
"inventory",
"vendor-products",
],
FrontendType.VENDOR: [
"products",
"inventory",
],
},
),
"orders": ModuleDefinition(
code="orders",
name="Order Management",
description="Order processing, fulfillment, and tracking.",
features=[
"order_management",
"order_bulk_actions",
"order_export",
"automation_rules",
"fulfillment_tracking",
"shipping_management",
],
menu_items={
FrontendType.ADMIN: [
"orders",
],
FrontendType.VENDOR: [
"orders",
],
},
),
"marketplace": ModuleDefinition(
code="marketplace",
name="Marketplace (Letzshop)",
description="Letzshop integration for product sync and order import.",
requires=["inventory"], # Depends on inventory module
features=[
"letzshop_sync",
"marketplace_import",
"product_sync",
],
menu_items={
FrontendType.ADMIN: [
"marketplace-letzshop",
],
FrontendType.VENDOR: [
"marketplace",
"letzshop",
],
},
),
# Inventory module - imported from app/modules/inventory/
"inventory": inventory_module,
# Orders module - imported from app/modules/orders/
"orders": orders_module,
# Marketplace module - imported from app/modules/marketplace/
"marketplace": marketplace_module,
"customers": ModuleDefinition(
code="customers",
name="Customer Management",