feat: complete marketplace module migration (Phase 6)

Migrates marketplace module to self-contained structure:
- Create app/modules/marketplace/services/ re-exporting from existing locations
- Create app/modules/marketplace/models/ with marketplace & letzshop models
- Create app/modules/marketplace/schemas/ with product & import schemas
- Create app/modules/marketplace/tasks/ with 5 Celery tasks:
  - process_marketplace_import - CSV product import
  - process_historical_import - Letzshop order import
  - sync_vendor_directory - Scheduled daily vendor sync
  - export_vendor_products_to_folder - Multi-language export
  - export_marketplace_products - Admin export
- Create app/modules/marketplace/exceptions.py
- Update definition.py with is_self_contained=True and scheduled_tasks

Celery task migration:
- process_marketplace_import, process_historical_import -> import_tasks.py
- sync_vendor_directory -> sync_tasks.py (scheduled daily at 02:00)
- export_vendor_products_to_folder, export_marketplace_products -> export_tasks.py

Backward compatibility:
- Legacy task files now re-export from new locations
- Remove marketplace/letzshop/export from LEGACY_TASK_MODULES

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-27 23:19:31 +01:00
parent 4f379b472b
commit eb47daec8b
15 changed files with 1088 additions and 704 deletions

View File

@@ -3,12 +3,12 @@
Marketplace module definition.
Defines the marketplace module including its features, menu items,
dependencies, and route configurations.
dependencies, route configurations, and scheduled tasks.
Note: This module requires the inventory module to be enabled.
"""
from app.modules.base import ModuleDefinition
from app.modules.base import ModuleDefinition, ScheduledTask
from models.database.admin_menu_config import FrontendType
@@ -34,6 +34,7 @@ marketplace_module = ModuleDefinition(
"Letzshop marketplace integration for product sync, order import, "
"and catalog synchronization."
),
version="1.0.0",
requires=["inventory"], # Depends on inventory module
features=[
"letzshop_sync", # Sync products with Letzshop
@@ -52,6 +53,26 @@ marketplace_module = ModuleDefinition(
],
},
is_core=False,
# =========================================================================
# Self-Contained Module Configuration
# =========================================================================
is_self_contained=True,
services_path="app.modules.marketplace.services",
models_path="app.modules.marketplace.models",
schemas_path="app.modules.marketplace.schemas",
exceptions_path="app.modules.marketplace.exceptions",
tasks_path="app.modules.marketplace.tasks",
# =========================================================================
# Scheduled Tasks
# =========================================================================
scheduled_tasks=[
ScheduledTask(
name="marketplace.sync_vendor_directory",
task="app.modules.marketplace.tasks.sync_tasks.sync_vendor_directory",
schedule="0 2 * * *", # Daily at 02:00
options={"queue": "scheduled"},
),
],
)